3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android M以上で CustomTabsでChromeが開かない問題の対応

Posted at

前置き

問題

  • PackageManager#queryIntentActivities の挙動が変わったため。

対応

  • PRが出ているのでそれを取り込みましょう。
  • 私は以下のように判定して使っています。
Helperクラス
    public static CustomTabsIntent createCustomTabsIntent(Context context) {
        String packageName = CustomTabsHelper.getPackageNameToUse(context);
        CustomTabsIntent intent = new CustomTabsIntent.Builder()
                .setShowTitle(true)
                .setToolbarColor(ContextCompat.getColor(context, R.color.white)).build();

        if (packageName != null) {
            intent.intent.setPackage(packageName);
        }
        return intent;
    }
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?