【问题标题】:EXTRA Parameters for Google Chrome Custom Tabs mayLaunchUrlGoogle Chrome 自定义标签的额外参数 mayLaunchUrl
【发布时间】:2015-05-29 15:26:39
【问题描述】:

Google 最近宣布了Google Chrome Custom Tabs,这是一种使用 Google chrome 功能打开网页而不是使用 webviews 的方法。

mayLaunchUrl 中使用的 Extra 捆绑包是否有所有可能的 KEYS 列表?

【问题讨论】:

    标签: android google-chrome chrome-custom-tabs


    【解决方案1】:

    现在看起来 mayLaunchUrl 的 extras Bundle 只是为了将来使用。因此,似乎没有键列表。

    mayLaunchUrl 上的 extras 字段:

    • @param extras 保留供将来使用。

    【讨论】:

      【解决方案2】:

      目前只为 mayLaunchUrl 实现了一个额外的功能:“org.chromium.chrome.browser.referrer_id”。

      【讨论】:

        【解决方案3】:

        This class 看起来很有希望:

          public final class CustomTabsIntent {
            method public void launchUrl(android.app.Activity, android.net.Uri);
            field public static final java.lang.String EXTRA_ACTION_BUTTON_BUNDLE = "android.support.customtabs.extra.ACTION_BUTTON_BUNDLE";
            field public static final java.lang.String EXTRA_CLOSE_BUTTON_ICON = "android.support.customtabs.extra.CLOSE_BUTTON_ICON";
            field public static final java.lang.String EXTRA_EXIT_ANIMATION_BUNDLE = "android.support.customtabs.extra.EXIT_ANIMATION_BUNDLE";
            field public static final java.lang.String EXTRA_MENU_ITEMS = "android.support.customtabs.extra.MENU_ITEMS";
            field public static final java.lang.String EXTRA_SESSION = "android.support.customtabs.extra.SESSION";
            field public static final java.lang.String EXTRA_TITLE_VISIBILITY_STATE = "android.support.customtabs.extra.TITLE_VISIBILITY";
            field public static final java.lang.String EXTRA_TOOLBAR_COLOR = "android.support.customtabs.extra.TOOLBAR_COLOR";
            field public static final java.lang.String KEY_DESCRIPTION = "android.support.customtabs.customaction.DESCRIPTION";
            field public static final java.lang.String KEY_ICON = "android.support.customtabs.customaction.ICON";
            field public static final java.lang.String KEY_MENU_ITEM_TITLE = "android.support.customtabs.customaction.MENU_ITEM_TITLE";
            field public static final java.lang.String KEY_PENDING_INTENT = "android.support.customtabs.customaction.PENDING_INTENT";
            field public static final int NO_TITLE = 0; // 0x0
            field public static final int SHOW_PAGE_TITLE = 1; // 0x1
            field public final android.content.Intent intent;
            field public final android.os.Bundle startAnimationBundle;
          }
        

        “可能启动 URL”听起来与 myLaunchUrl() 方法非常相似:

        最后但并非最不重要的一点是,如有必要,请使用 mayLaunchUrl() 方法通知 Chrome 可能导航到 URL 或 URL 列表。它还返回一个布尔值来通知您的自定义选项卡是否将被启动。如果为 false,则用户没有可用的最新版 Chrome,您需要决定是要从外部启动 Chrome 还是使用 Web 视图作为后备。请注意,作为最佳做法,请在 mayLaunchUrl() 之前调用 warmup()。

        见:An Introduction to Chrome Custom Tabs for Android

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2014-07-10
          • 2022-07-11
          • 1970-01-01
          • 2019-07-02
          • 1970-01-01
          • 2022-07-14
          • 1970-01-01
          相关资源
          最近更新 更多