Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Android activity destroy fix #92

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/android/CardIOCordovaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import android.os.Bundle;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
Expand Down Expand Up @@ -86,6 +87,12 @@ private void canScan(JSONArray args) throws JSONException {
}
}

// onSaveInstanceState
public Bundle onSaveInstanceState() {
Bundle state = new Bundle();
return state;
}

// onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (REQUEST_CARD_SCAN == requestCode) {
Expand All @@ -107,6 +114,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
}
}

// onRestoreStateForActivityResult
public void onRestoreStateForActivityResult(Bundle state, CallbackContext callbackContext) {
this.callbackContext = callbackContext;
}

private JSONObject toJSONObject(CreditCard card) {
JSONObject scanCard = new JSONObject();
try {
Expand Down