Vijay
Vijay

Reputation: 61

Invoke an Android App from a WebPage

Hi Is it possible to invoke an Android App from a Web Page that i am displaying on the phone browser to the user. I know that this is possible from an another Android App using Intents. But i am not sure if this is possible from a WebPage.

Thanks in advance.

Upvotes: 3

Views: 605

Answers (2)

Jess
Jess

Reputation: 42928

Intent filters with the BROWSABLE category will let you launch an application using a URI scheme. Inside your <activity>, add:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="myprotocol" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

and set up the action and categories how you want, and change the scheme to something relevant to your application.

Then inside your webpage, you can link to your application with

<a href="myprotocol://">test link</a>

Upvotes: 2

Timo Ohr
Timo Ohr

Reputation: 7947

Simply define a intent filter for a particular URI within your Activity: http://developer.android.com/guide/topics/manifest/data-element.html

That way, that activity will be called when a corresponding link is clicked. By using a custom scheme you'll make sure that your app is the only one responding.

It's the same way the android market responds to market links.

Upvotes: 1

Related Questions