Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Intent-从url首次加载时未找到附加项_Android_Android Intent - Fatal编程技术网

Android Intent-从url首次加载时未找到附加项

Android Intent-从url首次加载时未找到附加项,android,android-intent,Android,Android Intent,我正试图通过深度链接从网页加载我的应用程序 我正在使用window.location在点击网页时调用意图url 应用程序可以通过以下方式正常打开: 窗口位置(“intent://open/#Intent;scheme=testapp;package=gb.testapp.testapp;S.id=3026;end”)然而,我试图传递的id似乎只有在URL再次加载时才会出现 我在androidmanifest.xml中的意图是: <intent-filter> <acti

我正试图通过深度链接从网页加载我的应用程序

我正在使用window.location在点击网页时调用意图url

应用程序可以通过以下方式正常打开:
窗口位置(“intent://open/#Intent;scheme=testapp;package=gb.testapp.testapp;S.id=3026;end”)然而,我试图传递的id似乎只有在URL再次加载时才会出现

我在androidmanifest.xml中的意图是:

<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="testapp"  android:host="open" android:path="/" />
 </intent-filter>
这导致: 应用程序安装后首次打开url:

System.out﹕ URLLOAD -  testApp://open/
System.out﹕ URLLOAD -  NO PARAMS
再次打开URL

I/System.out﹕ URLLOAD -  testApp://open/?id=3026
I/System.out﹕ URLLOAD - FOUND PARAMS
有没有人遇到过类似的问题,或者可以看到我的代码有问题

谢谢,
Simon

我的猜测是,在您第一次启动Acivity(应用程序)时,将调用onCreate()方法,而不是onNewIntent()。对于所有后续调用,您的活动都会通过onNewIntent方法进行“更新”。

使用
intent
参数,而不是
getIntent()
正在调用的方法-每次它都会输出log.i(),只是没有检测到任何参数已通过onCreate中的intent是否有任何参数?
I/System.out﹕ URLLOAD -  testApp://open/?id=3026
I/System.out﹕ URLLOAD - FOUND PARAMS