如何在Android中单击URL来启动应用程序 [英] How to launch app on click of url in android
本文介绍了如何在Android中单击URL来启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果设备上安装了应用程序,则在单击url时启动应用程序.如果未在设备上安装应用,请打开playstore.
Launch app when click on url if app installed on device. if app not installed on device, open playstore.
<intent-filter>
<data android:scheme="app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
推荐答案
您必须深度链接您的应用,在要启动的活动(Manifiedt.xml)中添加以下行
You have to deep link your app, add following lines in activity (Manifiest.xml) which you want to launch
<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:host="screen" android:scheme="appname"/>
</intent-filter>
在浏览器中,只要您单击appname://screen
,就会启动您的应用活动,
in browser when ever you click appname://screen
your app activity will be launched,
根据您的要求替换应用名称和屏幕
replace appname and screen as per your requirement
请注意,如果您在浏览器中键入此url,它将在google中搜索,要使其正常工作,您必须在html页面中编写链接
Note if you type this url in browser it will search in google ,for this to work you have to write link in html page
这篇关于如何在Android中单击URL来启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文