2

I am using Firebase dynamic links in my android app to redirect users to either my app or google play store.

This is the shortened link https://neibar0.page.link/rkgZJpa61qBHaNeV9

When i try to open the shared link from WhatsApp with a browser other then Chrome I get "net::ERR_UNKNOWN_URL_SCHEME"

This is the expanded link i copied from browser

intent://neibar0.page.link/rkgZJpa61qBHaNeV9#Intent;package=com.google.android.gms;action=com.google.firebase.dynamiclinks.VIEW_DYNAMIC_LINK;scheme=https;S.browser_fallback_url=https://play.google.com/store/apps/details%3Fid%3Dcom.logical.neibar&pcampaignid%3Dfdl_short&url%3Dhttps://www.google.com/%3Finvitedby%253DISSEhMdsprRYj610V1hBm99mOU0F3;end;

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String uid = user.getUid();

String link = "https://www.google.com/?invitedby=" + uid;

DynamicLink dynamicLink = 
FirebaseDynamicLinks.getInstance().createDynamicLink()
    .setLink(Uri.parse(link))
    .setDomainUriPrefix("https://neibar0.page.link")
    .setAndroidParameters(new 
        DynamicLink.AndroidParameters.Builder("com.logical.neibar")
         .build()).setIosParameters(new 
        DynamicLink.IosParameters.Builder("com.example.ios").build())
            .buildDynamicLink();

final Uri dynamicLinkUri = dynamicLink.getUri();

//Function to generate short link returns shortLink

Intent intent =new Intent();
intent.setAction(Intent.ACTION_SEND);                      
intent.putExtra(Intent.EXTRA_TEXT,shortLink.toString());
intent.setType("text/plain");
startActivity(intent);

I want to redirect the user to play store if app not installed. The link is only working when opened in mobile chrome app.

Aryan Sharma
  • 105
  • 7

0 Answers0