从网站链接打开Cordova移动应用程序

时间:2015-08-14 11:11:10

标签: android ios cordova mobile youtube

我创建了一个类似于网站的应用程序。当用户在其iOS或Android设备上访问该网站时,我想输出一个链接,让他们打开或下载该应用程序。

例如,当您在移动设备上访问Youtube时会出现一个弹出窗口,说明在" YouTube":

中打开此页面

enter image description here 如果您点击此弹出窗口,则会在我的手机上打开YouTube应用。

我想用我的网站和应用程序来做这件事。该应用程序是使用Cordova创建的。有谁知道如何做到这一点?我发现this question类似,但它适用于原生iOS。我需要一个跨平台的Cordova解决方案。

2 个答案:

答案 0 :(得分:2)

试试这个:

<activity android:name=".MyActivity">
    <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="www.myapp.com" android:scheme="MyApp" />
    </intent-filter>
</activity>

答案 1 :(得分:1)

如果有人在将来寻找类似的解决方案。

正如@sanat shukla在评论中提到的,有一个由EddyVebruggen创建的插件允许你这样做:

https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin

相关问题