4

2 questions about using a QR code in an Android device: 1. Is it possible to launch a native Android application from a QR code? Maybe by some configured URI schema? 2. Another option which might be useful for me is to have a QR code scanner inside my own app. Will it be possible for me to somehow include a different app that scans QR codes inside my app? Or will I have to implement the scanning myself?

Thanks

Haji
  • 1,575
  • 6
  • 23
  • 38

2 Answers2

7

To scan barcodes in Android by Intent, see https://github.com/zxing/zxing/wiki/Scanning-Via-Intent

To trigger an app from a QR code, yes, you need to register the app to handle the particular custom URL scheme. This is how the same app can respond to clicks on the web: https://github.com/zxing/zxing/wiki/Scanning-From-Web-Pages

Look at how it registers to handle URLs here: https://github.com/zxing/zxing/blob/master/android/AndroidManifest.xml

PhilLab
  • 4,430
  • 19
  • 63
Sean Owen
  • 63,876
  • 22
  • 135
  • 169
1

1.to use a configured schema you can check this post

Launch custom android application from android browser

Then the you could QR code this scheme just like market://
2. You could use Bar code scanner app and use below code to launch or you could even integrate the zxing library to scan yourself.

   Intent intent = new Intent("com.google.zxing.client.android.SCAN");
   intent.setPackage("com.google.zxing.client.android");
   intent.putExtra("SCAN_MODE",
            "ONE_D_MODE,QR_CODE_MODE,PRODUCT_MODE,DATA_MATRIX_MODE");
   startActivityForResult(intent, 0);
Community
  • 1
  • 1
nandeesh
  • 24,272
  • 6
  • 65
  • 74