/** * Tells the browser of a likely future navigation to a URL. The most likely URL has to be * specified first. Optionally, a list of other likely URLs can be provided. They are treated as * less likely than the first one, and have to be sorted in decreasing priority order. These * additional URLs may be ignored. All previous calls to this method will be deprioritized. * * @param url Most likely URL. * @param extras Reserved for future use. * @param otherLikelyBundles Other likely destinations, sorted in decreasing likelihood order. * Inside each Bundle, the client should provide a {@link Uri} using {@link * CustomTabsService#KEY_URL} with {@link Bundle#putParcelable(String, * android.os.Parcelable)}. * @return true for success. */ public boolean mayLaunchUrl(Uri url, Bundle extras, List<Bundle> otherLikelyBundles) { try { return mService.mayLaunchUrl(mCallback, url, extras, otherLikelyBundles); } catch (RemoteException e) { return false; } }
/** * Updates the visuals for custom action buttons. Will only succeed if the given session is the * active one in browser and the given id is valid. * * @param id The id for the button to update. * @param icon The new icon of the action button. * @param description Content description of the action button. * @return Whether the update succeeded. */ public boolean setActionButton(int id, @NonNull Bitmap icon, @NonNull String description) { Bundle bundle = new Bundle(); bundle.putInt(CustomTabsIntent.KEY_ID, id); bundle.putParcelable(CustomTabsIntent.KEY_ICON, icon); bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, description); Bundle metaBundle = new Bundle(); metaBundle.putBundle(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle); try { return mService.updateVisuals(mCallback, metaBundle); } catch (RemoteException e) { return false; } }