0

I follow this blog to integrate zxing barcode scanner into my Android app natively. Thanks Zxing and the blog.

But there is a problem, if I already have installed the Zxing Qr code scanner in my mobile phone, when I'm going to launch "com.google.zxing.client.android.SCAN" using

Intent intent = new Intent("com.google.zxing.client.android.SCAN");

it will display a dialog let my select the application to do.(Sorry at this time I have no right to put a picture)

When there is no the Zxing Qr code scanner in my mobile, it works fine. Could somebody please tell my how to just let it work without the selection dialog. (When I chose my own app under the Zxing app, it will let a error and force my app down)

CharlesB
  • 86,532
  • 28
  • 194
  • 218
AmyWuGo
  • 2,315
  • 4
  • 22
  • 26
  • 1
    it is worth noting that if you check "don't ask again" and then select your app there will no longer be a pop-up from then on until the default gets reset from the settings. – FoamyGuy Apr 17 '12 at 21:55

1 Answers1

1

You can't do this on Android. The platform will always let the user choose how to handle an Intent when there are multiple options (or, when a new option becomes available). You can't force the user to skip the dialog and force a choice for the user.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • Thank you for your speedy answer. – AmyWuGo Apr 18 '12 at 00:45
  • Thank you for your speedy answer. Then I tried to copy all the core source to my application instead of using it as a jar. I tried this: Intent intent = new Intent(v.getContext(), CaptureActivity.class); but also it works just fine(it doesn't return the result), but when there is another app in my mobile it just go down without any alarm. If I have to reading the code and use the part I need? Some good idea? – AmyWuGo Apr 18 '12 at 00:52
  • Thank your answers.I copy all the source to my application, change the package name, and it's work fine. But when I install the app, it will occur two icons. I will have to handle that problem. – AmyWuGo Apr 18 '12 at 05:00