【问题标题】:How to open phonegap app from unique domain url?如何从唯一的域 url 打开 phonegap 应用程序?
【发布时间】:2020-11-04 02:18:15
【问题描述】:

我正在尝试使用 phonegap 为我的网站开发一个应用程序。所以我需要问 “您要从应用中打开此链接吗?” 当有人在应用程序安装的设备(如 facebook 网址)中打开我的网页网址时。我该怎么做?

【问题讨论】:

    标签: web url hyperlink phonegap


    【解决方案1】:

    我只需要 google 一下:open cordova app from url

    最多花了我 30 秒。

    您可以将其添加到您的 config.xml 中:

    <preference name="AndroidLaunchMode" value="singleTask" />
    
    <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="example.com" android:scheme="http" />
    </intent-filter>
    

    以及这个到你的 index.html 中:

    function deviceReady() {
        window.plugins.webintent.getUri(function(url) {
            console.log("INTENT URL: " + url);
            //...
        }); 
    }
    
    window.plugins.webintent.onNewIntent(function(url) {
        console.log("INTENT onNewIntent: " + url);
    });
    

    注意:这不是我的代码。在how can cordova open app from http or https url?找到它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-15
      • 1970-01-01
      • 2012-01-08
      • 2012-10-08
      • 2014-04-05
      • 1970-01-01
      相关资源
      最近更新 更多