简体   繁体   中英

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. 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?

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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