我已遵循分支https://help.branch.io/developers-hub/docs/android-sdk-overview的集成过程,它似乎可以正常工作,但是如果我从google chrome打开链接,则无法正常工作。
我从堆栈中得到了一些答案,但是我不知道我在哪里出错了。
午餐活动的onstart()方法未如其他问题所述
override fun onStart() {
super.onStart()
// Branch init
Branch.sessionBuilder(this).withCallback(branchListener).withData(this.intent?.data).init()
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
this.intent = intent
// Branch reinit (in case Activity is already in foreground when Branch link is clicked)
Branch.sessionBuilder(this).withCallback(branchListener).reInit()
}
object branchListener : Branch.BranchReferralInitListener {
override fun onInitFinished(referringParams: JSONObject?, error: BranchError?) {
if (error == null) {
Log.i(TAG, referringParams.toString())
// Retrieve deeplink keys from 'referringParams' and evaluate the values to determine where to route the user
// Check '+clicked_branch_link' before deciding whether to use your Branch routing logic
} else {
Log.e(TAG, error.message)
}
}
}