I am trying to do a simple thing - launch my android app from a html page running locally on my phone. Some more details :
- My android app is a test app which only launches the main activity and says hello world in a text view.
- The app isn't yet submitted to the android store.
- I launch the html page from my phone- it runs in the default chrome browser and I have a link which says "Launch App".
- 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>
- 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.
- 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>
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?
Is this feature limited to web-apps since I am trying to do this with a native android app.
Any help is highly appreciated.