开发者

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开发者_运维问答.


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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜