New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 763324 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: ----
Type: ----



Sign in to add a comment

question about MaylaunchUrl

Reported by ian_ho...@ab180.co, Sep 8 2017

Issue description

Application Version (from "Chrome Settings > About Chrome"): 60.03112.116
Android Build Number (from "Android Settings > About Phone/Tablet"): 6.01
Device: Galaxy Note4

Steps to reproduce: 
on MayLaunchUrl

Observed behavior: 
when i use MayLaunchUrl with my application, there is no pre-rendering occured
i checked my server's log. but nothing connecting or request.
it's not only for my application.because your demo also didn't connect anything.
do i need to change my manifest or add code after MayLaunchUrl??

here is my code plz check any thing wrong.


public class MainActivity extends AppCompatActivity{

 CustomTabServiceController customTabServiceController;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        customTabServiceController=new CustomTabServiceController(this,"my Server URL");
        customTabServiceController.bindCustomTabService();  
 }

public class CustomTabServiceController extends CustomTabsServiceConnection {
    private static final String PKG_NAME_CHROME = "com.android.chrome";

    private WeakReference<Context> mContextWeakRef;
    private String mWebsiteUrl;
    private CustomTabsSession mCustomTabsSession;

    public CustomTabServiceController(Context context, String websiteUrl) {
        mContextWeakRef = new WeakReference<Context>(context);
        mWebsiteUrl = websiteUrl;
    }

    @Override
    public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient customTabsClient) {

        if (customTabsClient != null) {
            customTabsClient.warmup(0);

            // Create a new session
            mCustomTabsSession = customTabsClient.newSession(null);

            // Let the session know that it may launch a URL soon
            if (!TextUtils.isEmpty(mWebsiteUrl)) {
                Uri uri = Uri.parse(mWebsiteUrl);
                if (uri != null && mCustomTabsSession != null) {

                    // If this returns true, custom tabs will work,
                    // otherwise, you need another alternative if you don't want the user
                    // to be launched out of the app by default
                    Bundle headers=new Bundle();
                    headers.putString("Cookie","name=test1");
                    boolean mayLaunchResult=mCustomTabsSession.mayLaunchUrl(uri, headers, null);
                    Log.d("testChromeTap","may launch occur : "+mayLaunchResult);


                }
            }
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {
        mCustomTabsSession = null;
    }

    public void bindCustomTabService() {
        Context ctx = mContextWeakRef.get();
        if (ctx != null) {
            Log.d("testChromeTap","open binding");
            CustomTabsClient.bindCustomTabsService(ctx, PKG_NAME_CHROME, this);
        }
    }

    public void unbindCustomTabService() {
        Context ctx = mContextWeakRef.get();
        Log.d("testChromeTap","close binding");
        if (ctx != null) {
            ctx.unbindService(this);
        }
    }
}

Expected behavior: 
pre-rendering or connection with my apache server
Frequency: 
i try it around 10 times
<number of times you were able to reproduce> 

Additional comments: 
if you hard to fix it plz give me any example code with MayLaunchUrl.(your demo isn't works... plz optimize for MayLaunch)...
 
Components: UI>Browser>Mobile>CustomTabs
Cc: yus...@chromium.org lizeb@chromium.org sbirch@chromium.org
Status: Untriaged (was: Unconfirmed)
Status: WontFix (was: Untriaged)
Not the correct forum.  Please use one of the mailing lists or discussion forums for questions about this.

Without investigating a ton, mayLaunchUrl is based on whether we think the user will actually use the request.  If the user doesn't actually navigate to the URL you send to Chrome, then it won't ever be used.

If you build a version of chromium locally and trace through it and find problems, then a bug would be the right forum, but not to diagnose why your app isn't working.

Sign in to add a comment