Android Question QRCode - download app or start app

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Is there a way to scan a QRCode and have it download / open a Google or iOS app and pass the data?

Be nice to offer the user the option to download the app if not installed and to start the app if it is installed.

BobVal
 

drgottjr

Expert
Licensed User
Longtime User
yes, there is a way. or at least there was a way. 2 ways,
actually. but as is often the case with google, stuff that
worked before no longer works.

basically, you create a "scheme" (https, mail-to, ftp are examples
of a "scheme". so we create a scheme called "bobval://"

now, you create a qr code whose message is "bobval://".
you could add some data, but let's keep it simple (because it's
not going to work anyway).

now, in the app that you want to be launched by the bobval://
scheme, you add an intent filter:

AddActivityText(Main,
<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="bobval" />
</intent-filter>
)

when you deploy your app to your device, the bobval scheme
is registered, so it's now an official "scheme"
depending on your qr code scanner, when it scans "bobval://",
your app is launched. the app name isn't needed. android sees
the scheme, and your app is the one that answers to it. good luck.

this seems to be the latest way:
https://developer.android.com/training/app-links/deep-linking

looks pretty much what i was familiar with before they gave it a fancy name.
 
Last edited:
Upvote 0
Top