【问题标题】:cordova open app from url - application error科尔多瓦从 url 打开应用程序 - 应用程序错误
【发布时间】:2015-09-08 12:48:29
【问题描述】:

我正在尝试从外部链接打开我的科尔多瓦应用程序,例如 http://www.myurl.com/mypage 当应用打开时会发出警报

应用程序错误:与服务器的连接不成功。 (file:///android_asset/www/www.myurl.com/mypage)

我想我需要以某种方式处理传入的 url,但是这个警报马上就会出现。 尝试使用“webintent.onNewIntent”和“webintent.getUri”但没有成功。

这是我的代码:

config.xml:

<preference name="AndroidLaunchMode" value="singleTask"/>

android 清单文件:

<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.myurl.com" android:scheme="http" />
</intent-filter>

index.html

 <script>
    document.addEventListener('deviceready', function () {

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

        window.plugins.webintent.onNewIntent(function (url) {
            console.log("INTENT onNewIntent: " + url);
        }, function (error) {
            console.log(error);
        });
    }, false);
</script>

我错过了什么?

【问题讨论】:

  • 这两个事件处理程序中的控制台日志是否发生了?你能看到日志出来吗?听起来好像您在某处有一个不同的事件处理程序正在处理这些东西并尝试将 URL 作为文件打开,这可能吗?
  • 不,它没有。在我的任何页面 html 或脚本加载之前,甚至在 WebIntent.java 中的代码之前弹出警报

标签: android cordova phonegap-plugins webintents


【解决方案1】:

发现问题了……

我有另一个插件LaunchMyApp 干扰。 删除它就可以了。

【讨论】:

    猜你喜欢
    • 2017-06-08
    • 1970-01-01
    • 2017-12-16
    • 2015-11-09
    • 1970-01-01
    • 1970-01-01
    • 2015-09-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多