我在清单中定义了以下内容:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.package">
...
<activity
android:name="app.myActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<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" />
<!-- note that the leading "/" is required for pathPrefix-->
<!-- Accepts URIs that begin with "example://gizmos”-->
<data
android:host="gizmos"
android:scheme="example" />
</intent-filter>
</activity>
...
Run Code Online (Sandbox Code Playgroud)
我已经定义了我的onCreate():
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) {
Log.d("URI",data.toString());
}
}
Run Code Online (Sandbox Code Playgroud)
这符合Android文档:Android Deep Linking
所以问题是:
如何测试URI深层链接?根据文档我运行的东西
adb shell …