Wednesday, March 9, 2011

QR-code to launch your app

Android intents are powerful, you can even set you application to launch on a certain URL.

Launch app on defined URL

To make your app launch on a specific URL you simply create an 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="" android:path="/travalert"/>

This way you can have your application launched from a QR-code containing the specific URL. Nice thing is that if the app isn't installed the user will most likely have the url opened in a browser instead.


  1. Hi, could you clarify what should be the url which will be used to launch that app, because I've tried few urls but always a browser has been opened

  2. I managed to get it :). If someone complete example, let's take a look here:

    in the comments below there is example project.

  3. Glad to hear you solved it. Maybe I was a bit vague on the details ;)

  4. String contents = intent.getStringExtra("SCAN_RESULT");
    String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
    // Handle successful scan
    } else if (resultCode == RESULT_CANCELED) {
    // Handle cancel