1

I am trying to do a simple thing - launch my android app from a html page running locally on my phone. Some more details :

  1. My android app is a test app which only launches the main activity and says hello world in a text view.
  2. The app isn't yet submitted to the android store.
  3. I launch the html page from my phone- it runs in the default chrome browser and I have a link which says "Launch App".
  4. I expect my android app to be launched and main activity to be started when I click this link. But instead it takes me to the play store and says "Item not found". My android manifest looks like

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
                <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="launchMyApp.com"/>
            </intent-filter>
        </activity>
    </application>

And my html looks like

<!DOCTYPE html>
<html>
<body>

 <p><a href="intent://main/#Intent;scheme=http;package=launchMyApp.com;end"> Launch My App </a></p>
  <p> <a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"> Take a QR code </a></p>
</html>
Questions I have :
  1. Firstly ofcourse I am doing soemthing wrong here, unable to identify if my href tag is incorrect or if I need to add more code in my android app, please help me with that.
  2. How does the browser identify what to do when it parses the href component? Like for example if I create a link to go to google I would write

<a href="http://www.google.com">Go to Google</a>
So is it the intent tag that tells the browser you have to look for an android intent?
  1. Does my html page need to be hosted on a server or the android app need to be in the playstore for this to work?

  2. Is this feature limited to web-apps since I am trying to do this with a native android app.

Any help is highly appreciated.

API
  • 449
  • 3
  • 12

0 Answers0