Example usage for org.apache.cordova CordovaPlugin hasPermisssion

List of usage examples for org.apache.cordova CordovaPlugin hasPermisssion

Introduction

In this page you can find the example usage for org.apache.cordova CordovaPlugin hasPermisssion.

Prototype

public boolean hasPermisssion() 

Source Link

Usage

From source file:com.zsxsoft.cordova.x5.X5WebChromeClient.java

License:Apache License

@Override
/**//from w  ww . ja v a 2  s.c o m
 * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
 *
 * This also checks for the Geolocation Plugin and requests permission from the application  to use Geolocation.
 *
 * @param origin
 * @param callback
 */
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissionsCallback callback) {
    super.onGeolocationPermissionsShowPrompt(origin, callback);
    callback.invoke(origin, true, false);
    //Get the plugin, it should be loaded
    CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
    if (geolocation != null && !geolocation.hasPermisssion()) {
        geolocation.requestPermissions(0);
    }

}

From source file:org.jeremyup.cordova.x5engine.X5WebChromeClient.java

License:Apache License

/**
 * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
 *
 * This also checks for the Geolocation Plugin and requests permission from the application  to use Geolocation.
 *
 * @param origin/*  w w  w  .  ja v a  2  s.  c om*/
 * @param callback
 */
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissionsCallback callback) {
    super.onGeolocationPermissionsShowPrompt(origin, callback);
    callback.invoke(origin, true, false);
    //Get the plugin, it should be loaded
    CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
    if (geolocation != null && !geolocation.hasPermisssion()) {
        geolocation.requestPermissions(0);
    }

}