Chrome Custom Tabs redirect to Android app will close the app

前端 未结 4 702
别那么骄傲
别那么骄傲 2020-12-10 13:01

I am trying to implement an OAuth2 flow with an Android Chrome Custom Tab but my app is always closed (no crash) when the Chrome Custom Tab is receiving the 302 with the loc

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 13:08

    It helped me to set the Activity that I use to start a CustomTab to singleInstance mode in the manifest file:

        
    

    And in the code I do as usual:

        CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
        final CustomTabsIntent customTabsIntent = builder.build();
        customTabsIntent.intent.setPackage(someChromePackage);
        customTabsIntent.launchUrl(singleInstanceModeActivity, someUriThatDoesRedirect);
    

    I tried warming up Chrome and even calling customTabsIntent.launchUrl() with some delay after calling client.warmup(0l); and neither helped.

提交回复
热议问题