[英]Open Android app through browser if app is installed else open playstore
I have an app-url which opens app if installed and a playstore url which list my app on playstore 我有一个应用程序网址(如果已安装)会打开应用程序,还有一个Playstore网址,该网址会在Playstore上列出我的应用程序
app-url is like custom:// app-url就像custom://
and playstore url is like market:// 而playstore网址就像market://
I have to make a button in my webpage which onclicking opens app if installed otherwise open playstore. 我必须在网页上创建一个按钮,如果已安装,则onclicking会打开应用程序,否则打开playstore。
I know there is no way in Android to detect whether the mobile has app installed or not through javascript calls. 我知道Android中无法通过javascript调用来检测移动设备是否已安装应用程序。
Currently I am using intent url which does the same that i require but it does that only for chrome v 25+. 目前,我正在使用意图网址,该网址的功能与我所需的功能相同,但仅适用于chrome v 25+。
I want to do it for all browsers. 我想对所有浏览器都这样做。
I have tried using frames and timeout but it shows a pop-up in firefox that "couldn't find an application to open the link" 我尝试使用帧和超时,但是它显示了Firefox中的弹出窗口,“找不到用于打开链接的应用程序”
What should be stable and correct way to do it for all browsers? 对于所有浏览器,应该采用哪种稳定,正确的方法来做到这一点?
You can specify an intentfilter in the manifest file to open URL in your application. 您可以在清单文件中指定一个intentfilter,以在应用程序中打开URL。
Example is given below. 示例如下。
<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" />
<data android:scheme="https" />
</intent-filter>
This url you could fetch from your activity using intent. 您可以使用intent从活动中获取此网址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.