Search code examples
androidzxing

How does the zxing.appspot.com/scan webpage open the barcode scanner in Android?


The scan.html in the source has no action specific to a barcode scanner attached to the click event of the "click here" link. as seen in :

<p>To scan barcode and return to webpage <a href="">click here</a></p>

Where is this connection made? How does the browser know that when I go to zxing.appspot.com/scan, it has to open the barcode scanner app? Does the barcode scanner app hold this information?


Solution

  • there's an intent filter for it in the Manifest https://github.com/zxing/zxing/blob/master/android/AndroidManifest.xml

    <intent-filter>
       <action android:name="android.intent.action.VIEW"/>
       <category android:name="android.intent.category.DEFAULT"/>
       <category android:name="android.intent.category.BROWSABLE"/>
       <data android:scheme="http" android:host="zxing.appspot.com" android:path="/scan"/>
    </intent-filter>