简体   繁体   English

如何使用Branch.io深度链接获取我的Android应用并支持最小化/恢复该应用?

[英]How can I get my Android app with use Branch.io Deeplinking AND support minimize/resume the app?

I am using Branch.io deeplinking in my Android app, and for the most part, it works well under most scenarios. 我在Android应用中使用Branch.io深层链接,并且在大多数情况下,它在大多数情况下都可以正常工作。 However, I have a scenario where I register a user (to my service); 但是,我有一个注册用户(向我的服务注册)的方案; and in that flow, the user requests an SMS verification code, and thus has to leave the app (minimize) to read it, then re-enter the app (restore) to validate to code. 并且在该流程中,用户请求SMS验证码,因此必须离开应用程序(最小化)以读取它,然后重新进入应用程序(还原)以进行编码验证。

I had this behavior working perfectly before implementing branch.io, and the reason has to do with Branch.io requiring android:launchMode="singleTask" in the AndroidManifest.xml file (see here ). 实现branch.io 之前 ,我已经完美地执行了此行为,原因与Branch.io要求在AndroidManifest.xml文件中看到android:launchMode="singleTask" (请参阅此处 )有关。

<activity
   android:name="com.yourapp.SplashActivity"
   android:label="@string/app_name"
   android:launchMode="singleTask"
   ...

When android:launchMode="singleTask" is removed, the user can leave/enter the app as much as they want and are always returned to the same activity that they were on when they minimized the app. 删除android:launchMode="singleTask" ,用户可以随意离开/进入应用程序,并且始终返回最小化应用程序时的活动。 Yet, Branch.io deeplinking is no longer respected. 但是,不再尊重Branch.io深层链接。

HOWEVER , it seems that this minimize/restore behaivor is not (?) possible with Branch.io is implemented. 但是 ,看来使用Branch.io实现此最小化/还原行为是不可能的 (?)。 Is it? 是吗? How can I retain the minimize/restore functionality of my app, which implementing Branch.io deeplinking? 如何保留我的应用程序的最小化/还原功能,该功能实现了Branch.io深层链接?

In addition to Amruta's comment I wanted to contribute. 除了Amruta的评论外,我还想贡献一点。 As singleTask is required for proper deep linking to avoid multiple instances of the same activity, our best workaround/suggestion for this issue which hasn't been mentioned yet is to create a transparent deep linking activity. 正确的深层链接需要singleTask来避免同一活动的多个实例,因此针对此问题的最佳解决方法/建议(尚未提及)是创建透明的深层链接活动。 This way you can set a throw away transparent activity to singleTask, init session from it it -> grab params -> route accordingly. 这样,您可以为singleTask设置一个扔掉透明的活动,并从中进行初始化会话->抓取参数->路由。 Otherwise you're stuck adjusting your main app flow to our requirement of using singleTask. 否则,您将不得不根据我们使用singleTask的要求调整主应用程序流程。 This tends to be the most popular workaround! 这往往是最流行的解决方法!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM