Ad

Flutter Problem Dynamic Link Opens The App Inside Whatsapp

When the link is opened via whatsapp, an instance of the app is opened inside whatsapp, if the app is later opened by the launcher. 2 instances of the same app are open, one by whatsapp the other by the app itself.

Steps to reproduce Steps to reproduce the behavior:

1 - Generate the link and send it to whatsapp. 2 - Click the link on whatsapp

Expected behavior It is expected that after the click, the app will be opened outside of whatsapp

FirebaseDynamicLinks.instance.getInitialLink().then((value){
    if (value != null){
        if (value.link.queryParameters["challenge_id"] != null){
            DesafioModel desafioModel = DesafioModel();
            desafioModel.id = value.link.queryParameters["challenge_id"];
            Get.offNamed("$CHALLENGE_DETAILS_ROUTE", arguments: desafioModel);
         }
     }
 });
Ad

Answer

For others who need it, as Jiten Basnet noted in the comments, the solution is to add

android:launchMode="singleTask" 

inside activity in AndroidManifest.xml.

Ad
source: stackoverflow.com
Ad