Jim*_*nts 2 android uri deep-linking
我在 Android Studio 中启动了一个新项目并将其添加到我的androidmanifest.xml:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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.example.com"
android:pathPrefix="/gizmos"
android:scheme="http"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
然后我转到 Google Chrome 并输入:http://www.example.com/gizmos。该应用程序打不开。然后尝试命令行:
mac-van-jim:DeeplinkTest jimclermonts$ adb shell am start -n eu.theappfactory.deeplinktest/MainActivity
Starting: Intent { cmp=eu.theappfactory.deeplinktest/MainActivity }
Error type 3
Error: Activity class {eu.theappfactory.deeplinktest/MainActivity} does not exist.
Run Code Online (Sandbox Code Playgroud)
和这个:
mac-van-jim:DeeplinkTest jimclermonts$ adb shell am start -W -a android.intent.action.VIEW -d "http://www.example.com" eu.theappfactory
Starting: Intent { act=android.intent.action.VIEW dat=http://www.example.com/... pkg=eu.theappfactory }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=http://www.example.com/... flg=0x10000000 pkg=eu.theappfactory }
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这些线程:
什么都不起作用?我记得这曾经有用过吗?也许是因为新的 Android 应用程序链接?
编辑:我发现它在 Chrome 中不再起作用,但是在创建和上传网页时,它也不起作用:
<!DOCTYPE html>
<html>
<head>
<body>
<a href="Click here" target="_blank">http://www.example.com/gizmos</a>
</body>
</head>
</html>
Run Code Online (Sandbox Code Playgroud)
要使用提供的 url 启动您的应用程序,您应该运行以下命令:
adb shell "am start 'http://www.example.com/gizmos'"
Run Code Online (Sandbox Code Playgroud)
此外,如果您复制/粘贴 URL 搜索栏中的链接,Chrome 不会打开您的应用程序。
| 归档时间: |
|
| 查看次数: |
6285 次 |
| 最近记录: |