Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
avoid calling other apps activity
Browse files Browse the repository at this point in the history
  • Loading branch information
Eccenux authored and EddyVerbruggen committed Jun 26, 2014
1 parent cfa698d commit ef1155d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
public void scan() {
Intent intentScan = new Intent(SCAN_INTENT);
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// avoid calling other phonegap apps
intentScan.setPackage(this.cordova.getActivity().getApplicationContext().getPackageName());

this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}
Expand Down Expand Up @@ -163,6 +165,8 @@ public void encode(String type, String data) {
Intent intentEncode = new Intent(ENCODE_INTENT);
intentEncode.putExtra(ENCODE_TYPE, type);
intentEncode.putExtra(ENCODE_DATA, data);
// avoid calling other phonegap apps
intentEncode.setPackage(this.cordova.getActivity().getApplicationContext().getPackageName());

this.cordova.getActivity().startActivity(intentEncode);
}
Expand Down

0 comments on commit ef1155d

Please sign in to comment.