安卓深度链接路径模式




我有这个网址 https://myportal.net/#!/search/main/34 当用户点击URL打开应用程序时,我需要插入深层链接。

注意:网址中的 34 号正在更改

我执行以下操作,但它不起作用

<activity
android:name="ui.Activities.SplashActivity"
android:configChanges="orientation|keyboardHidden|screenSize"

android:theme="@style/SplashScreen">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="${hostName}"
android:pathPattern="/.*/.*/.*/.*"
android:scheme="https" />
</intent-filter>

在您的飞溅活动中

private void handleDeepLink(Intent intent) {
FirebaseDynamicLinks.getInstance()
.getDynamicLink(intent)
.addOnSuccessListener(pendingDynamicLinkData -> {
// Get deep link from result (may be null if no link is found)
Uri deepLink;
String finalLink = "";
if (pendingDynamicLinkData != null) {
deepLink = pendingDynamicLinkData.getLink();

String string = String.valueOf(deepLink);
String decodeUrl = Utils.decodeUrl(string);
String[] parts = decodeUrl.split("main/");
String part1= parts[0]; 
String part2= parts[1];
finalLink = part2.replaceAll(" ", "+");
Log.w("dynamiclink", finalLink);
if (!Validator.isEmptyString(finalLink)) {
getDataManager().setAuthSecret(finalLink);
}
}
getNavigator().openRegistrationActivity(finalLink);
})
.addOnFailureListener(e -> {
getNavigator().openRegistrationActivity("");
});`
}

在您的最严重文件中

<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data
android:host="nms-rx.in"
android:pathPrefix="main/"
android:scheme="https" />
</intent-filter>

最新更新