public boolean start()

in auth-lib/src/auth/java/com/spotify/sdk/android/auth/browser/BrowserAuthHandler.java [61:103]


    public boolean start(Activity contextActivity, AuthorizationRequest request) {
        Log.d(TAG, "start");
        mContext = contextActivity;
        mUri = request.toUri();
        String packageSupportingCustomTabs = getPackageSupportingCustomTabs(mContext, request);
        boolean shouldLaunchCustomTab = !TextUtils.isEmpty(packageSupportingCustomTabs);

        if (internetPermissionNotGranted(mContext)) {
            Log.e(TAG, "Missing INTERNET permission");
        }

        if (shouldLaunchCustomTab) {
            Log.d(TAG, "Launching auth in a Custom Tab using package:" + packageSupportingCustomTabs);
            mTabConnection = new CustomTabsServiceConnection() {
                @Override
                public void onCustomTabsServiceConnected(@NonNull ComponentName name, @NonNull CustomTabsClient client) {
                    client.warmup(0L);
                    mTabsSession = client.newSession(new CustomTabsCallback());
                    if (mTabsSession != null) {
                        CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().setSession(mTabsSession).build();
                        customTabsIntent.launchUrl(mContext, request.toUri());
                        mIsAuthInProgress = true;
                    } else {
                        unbindCustomTabsService();
                        Log.i(TAG, "Auth using CustomTabs aborted, reason: CustomTabsSession is null.");
                        launchAuthInBrowserFallback();
                    }
                }

                @Override
                public void onServiceDisconnected(ComponentName name) {
                    Log.i(TAG, "Auth using CustomTabs aborted, reason: CustomTabsService disconnected.");
                    mTabsSession = null;
                    mTabConnection = null;
                }
            };
            CustomTabsClient.bindCustomTabsService(mContext, packageSupportingCustomTabs, mTabConnection);
        } else {
            Log.d(TAG, "Launching auth inside a web browser");
            launchAuthInBrowserFallback();
        }
        return true;
    }