Android 分支深度链接通知不起作用
我试图在读取分支io deeplink的参数后对其进行自定义重定向Android 分支深度链接通知不起作用,android,deep-linking,branch.io,Android,Deep Linking,Branch.io,我试图在读取分支io deeplink的参数后对其进行自定义重定向 Intent resultIntent = new Intent(context, BlankBranchShareActivity.class); resultIntent.putExtra("branch", "https://bnc.lt/EcMh/POIo83vYev"); PendingIntent resultPendingIntent = PendingIntent.getActivity(co
Intent resultIntent = new Intent(context, BlankBranchShareActivity.class);
resultIntent.putExtra("branch", "https://bnc.lt/EcMh/POIo83vYev");
PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
String title = "DeepLink";
String message = "messageDeepLink";
String summaryText = "summaryText";
NotificationUtility.createNotification(context, title,
message, summaryText,
mNotificationId++, resultPendingIntent,
CancelNotificationResponse.getPendingIntent(context, messageType));
通知正在发出并显示,当我单击通知时,它将重定向到BlankBranchShareActivity.class
public class BlankBranchShareActivity extends AppCompatActivity {
private static final String TAG = BlankBranchShareActivity.class.getName();
private Branch branch;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
branch = Branch.getInstance();
}
@Override
public void onStart() {
super.onStart();
branch.initSession(branchReferralInitListener, this.getIntent().getData(), this);
}
Branch.BranchReferralInitListener branchReferralInitListener = new Branch.BranchReferralInitListener() {
@Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
String label = "";
if (referringParams != null)
label = "ReferringParams" + referringParams.toString();
if (error == null) {
JSONObject json = referringParams;
onCodeResume(json);
return;
}
if (AppConstants.DEBUG) {
Log.i(TAG, "onStart()" + label + ",Error:" + error);
}
openMainActivity();
}
};
protected void onCodeResume(JSONObject json) {
super.onResume();
try {
Log.i(TAG, "onResume: " + "Called" + json.toString());
/*If nothing is their to-launch immediately Launch Main activity */
if (json == null || json.toString().equals("{}") || (!json.has(JsonKeys.BRANCH_IO_JOB_SHARE_KEY) && !json.has(JsonKeys.BRANCH_IO_SHARE_TYPE_SHARE_KEY))) {
return;
}
//Do Operation
} catch (JSONException e) {
Crashlytics.logException(e);
Log.e(TAG, "onResume: " + e.toString());
}
}
private void openMainActivity() {
Intent in = new Intent(this, MainActivityList.class);
startActivity(in);
}
@Override
public void onNewIntent(Intent intent) {
this.setIntent(intent);
}
@Override
protected void onStop() {
super.onStop();
if (branch != null) {
branch.closeSession();
}
}
}
每当我点击链接时,它都会为重定向提供适当的参数,但是
当我发送与通知相同的链接时,我收到
{"+is_first_session":false,"+clicked_branch_link":false}
我可能做错了什么
<activity
android:name=".BlankBranchShareActivity"
android:launchMode="singleTask"
android:noHistory="true"
android:theme="@style/RegisterActivityTheme">
<!-- App Link your activity to Branch links-->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!--Test key-->
<data
android:host="bnc.lt"
android:pathPrefix="/cdMh"
android:scheme="https" />
<!--Production key-->
<data
android:host="bnc.lt"
android:pathPrefix="/EcMh"
android:scheme="https" />
<data
android:host="bnc.lt"
android:pathPrefix="/EcMh"
android:scheme="workindia" />
</intent-filter>
<meta-data
android:name="io.branch.sdk.auto_link_keys"
android:value="@string/branch_meta_all_keys_for_marking_on_manifest" />
<!-- Deep link path for auto deep linking -->
<meta-data android:name="io.branch.sdk.auto_link_path" android:value="workindia/*" />
</activity>
获取“clicked\u branch\u link:false”是键不匹配的结果。如果您正在单击测试实例中的链接,但您的应用程序正在使用Live key进行初始化,您将被单击\u branch\u link:false。Alex from branch here:通过推送通知发送分支链接是我们实际上不常看到的功能之一,即使它受支持。你能帮我们的集成工程团队看一下吗?