问题
I am using Branch.io deeplinking in my Android app, and for the most part, it works well under most scenarios. 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.
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).
<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. Yet, Branch.io deeplinking is no longer respected.
HOWEVER, it seems that this minimize/restore behaivor is not (?) possible with Branch.io is implemented. Is it? How can I retain the minimize/restore functionality of my app, which implementing Branch.io deeplinking?
回答1:
In addition to Amruta's comment I wanted to contribute. 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. This way you can set a throw away transparent activity to singleTask, init session from it it -> grab params -> route accordingly. Otherwise you're stuck adjusting your main app flow to our requirement of using singleTask. This tends to be the most popular workaround!
来源:https://stackoverflow.com/questions/45824644/how-can-i-get-my-android-app-with-use-branch-io-deeplinking-and-support-minimize