I want to know if it's possible in android to start application using QR Code reader. The things that I want to achieve is :
I create QR Code and after scanning it with QR Code reader I need to start my application with some params, maybe it will looks something like this : myApp://org.hardartcore.myApp?myParams or maybe something similar to this, not really sure.
Is there anyway to achieve this and to get the param which is build in the qr code with the intent for launching the application.
Yes. In
AndroidManifest.xml
, in your<activity>
, declare that the app responds to this URL:(I think you may have to end with a "/" before your "?" for this to work.)
Then anything that uses the platform to resolve a URL will open your app. Hyperlinks in a web browser will work.
The URL itself can be retrieved with
getIntent().getDataString()
. You can parse it as anandroid.net.Uri
as you like.Look at
CaptureActivity
in ZXing for an example of how it does this.Yes It is possible by using intent.
Create QR CODE with this text :
myApp://extraString
and read it with any qr code reader. Or even you can integrate your own qr code reader usingZxing
's open source. And you can get theextraString
as @Sean Owen mentioned usinggetIntent().getDataString()
. And don't forget to add this in your manifest file :That should work.