Java Code Examples for android.support.customtabs.CustomTabsSession#mayLaunchUrl()

The following examples show how to use android.support.customtabs.CustomTabsSession#mayLaunchUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Browser.java    From OsmGo with MIT License 6 votes vote down vote up
@PluginMethod()
public void prefetch(PluginCall call) {
  JSArray urls = call.getArray("urls");
  if (urls == null || urls.length() == 0) {
    call.error("Must provide an array of URLs to prefetch");
    return;
  }

  CustomTabsSession session = getCustomTabsSession();

  if (session == null) {
    call.error("Browser session isn't ready yet");
    return;
  }

  try {
    for (String url : urls.<String>toList()) {
      session.mayLaunchUrl(Uri.parse(url), null, null);
    }
  } catch(JSONException ex) {
    call.error("Unable to process provided urls list. Ensure each item is a string and valid URL", ex);
    return;
  }
}
 
Example 2
Source File: CustomTabActivityHelper.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}.
 * @return true if call to mayLaunchUrl was accepted.
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 3
Source File: CustomTabActivityHelper.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}.
 * @return true if call to mayLaunchUrl was accepted.
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 4
Source File: CustomTabActivityHelper.java    From materialup with Apache License 2.0 5 votes vote down vote up
/**
 * @return true if call to mayLaunchUrl was accepted
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 5
Source File: ChromeCustomTabsManager.java    From Anecdote with Apache License 2.0 5 votes vote down vote up
/**
 * Prevent the Chrome client that the given url may be opened.
 */
public void mayLaunch(String url) {
    if (mClient == null || url == null) {
        return;
    }
    Log.i(TAG, "mayLaunch " + url);
    CustomTabsSession session = getSession();
    session.mayLaunchUrl(Uri.parse(url), null, null);
}
 
Example 6
Source File: CustomTabActivityHelper.java    From AndroidProjects with MIT License 5 votes vote down vote up
/**
 * @return true if call to mayLaunchUrl was accepted.
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}.
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 7
Source File: CustomTabActivityHelper.java    From MaterialHome with Apache License 2.0 5 votes vote down vote up
/**
 * @return true if call to mayLaunchUrl was accepted
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 8
Source File: CustomTabActivityHelper.java    From android-proguards with Apache License 2.0 5 votes vote down vote up
/**
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}
 * @return true if call to mayLaunchUrl was accepted
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 9
Source File: CustomTabActivityHelper.java    From droidddle with Apache License 2.0 5 votes vote down vote up
/**
 * @return true if call to mayLaunchUrl was accepted
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 10
Source File: CustomTabActivityHelper.java    From custom-tabs-client with Apache License 2.0 5 votes vote down vote up
/**
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}.
 * @return true if call to mayLaunchUrl was accepted.
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 11
Source File: ChromeCustomTabsHelper.java    From Hews with MIT License 5 votes vote down vote up
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mCustomTabsClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 12
Source File: CustomTabServiceHelper.java    From cordova-plugin-safariviewcontroller with MIT License 5 votes vote down vote up
/**
 * @see {@link CustomTabsSession#mayLaunchUrl(Uri, Bundle, List)}.
 * @return true if call to mayLaunchUrl was accepted.
 */
public boolean mayLaunchUrl(Uri uri, Bundle extras, List<Bundle> otherLikelyBundles) {
    if (mClient == null) return false;

    CustomTabsSession session = getSession();
    if (session == null) return false;

    return session.mayLaunchUrl(uri, extras, otherLikelyBundles);
}
 
Example 13
Source File: ChromeCustomTabPlugin.java    From cordova-plugin-safariviewcontroller with MIT License 5 votes vote down vote up
private boolean mayLaunchUrl(String url){
    boolean success = false;
    if (mCustomTabPluginHelper.getClient() != null) {
        CustomTabsSession session = getSession();
        success = session.mayLaunchUrl(Uri.parse(url), null, null);
    }

    return success;
}