Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Zxing Barcode scanner causes SecurityException
    text
    copied!<p>I use Zxing Barcode Scanner in my app via launching an <code>Intent</code> so that I can scan a barcode and get the data back to my app. Very basic stuff; it has worked for a long time no problem. I recently got an error report through Play with the following stack trace:</p> <pre><code> java.lang.SecurityException: Permission Denial: starting Intent { act=com.google.zxing.client.android.SCAN cmp=com.ups.mobile.android/com.google.zxing.client.android.CaptureActivity } from ProcessRecord{421bafc8 11687:edu.byu.dburner.lendablefree/10141} (pid=11687, uid=10141) not exported from uid 10137 at android.os.Parcel.readException(Parcel.java:1327) at android.os.Parcel.readException(Parcel.java:1281) at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1736) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1383) at android.app.Activity.startActivityForResult(Activity.java:3281) at edu.byu.dburner.lendable.xxxxx.xxxx$2.onClick(xxxxxx.java:539) at android.view.View.performClick(View.java:3644) at android.view.View$PerformClick.run(View.java:14313) at android.os.Handler.handleCallback(Handler.java:605) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4514) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>As far as I can tell with the stack trace, there is some issue with <code>com.ups.mobile.android</code>, which is the UPS app that also utilizes the Zxing app. I tried installing the UPS app and mine on the same phone and triggering the <code>onClick</code> event where the problem occurred. Nothing significant occurs, except a chooser asking me to pick the Barcode Scanning app or the UPS app to perform the <code>Intent</code>. My only guess would be that both of our apps are having some sort of collision where only one person can use the Barcode Scanner package at a time, resulting in a SecurityException. But that doesn't make much sense to me since I can do it no problem, and I imagine many people have multiple apps that use Zxing installed with no issue.</p> <p>Does anyone have an insights into what causes this error and what I can do to fix it?</p> <p>EDIT: Per SeanOwen's comment, if you have this trouble with Barcode Scanner specifically, really do use <code>IntentIntegrator</code>. They provide a built-in method <code>setTargetApplications</code>. You can use this to make the <code>Intent</code> only use the actual Barcode Scanner app: <code>setTargetApplications(IntentIntegrator.TARGET_BARCODE_SCANNER_ONLY);</code> Easy as pie.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload