cordova 从 url 打开应用程序 - 应用程序错误
cordova open app from url - application error
我正在尝试从外部 link 打开我的 cordova 应用程序,例如
http://www.myurl.com/mypage 并且当应用程序打开时它会发出警报
Application error: the connection to the server was unsuccesful. (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>
我错过了什么?
找到问题了...
我有另一个插件 LaunchMyApp 干扰。
删除它就可以了。
我正在尝试从外部 link 打开我的 cordova 应用程序,例如 http://www.myurl.com/mypage 并且当应用程序打开时它会发出警报
Application error: the connection to the server was unsuccesful. (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>
我错过了什么?
找到问题了...
我有另一个插件 LaunchMyApp 干扰。 删除它就可以了。