Code example for GeolocationPermissions.Callback

Methods: invoke

0
        public void onGeolocationPermissionsShowPrompt(String origin,
          Callback callback) {
          final Callback theCallback = callback;
          final String theOrigin = origin;
          if (!caller.PromptforPermission()) { // Don't prompt, assume permission
            callback.invoke(origin, true, true);
            return; 
          } 
          AlertDialog alertDialog = new AlertDialog.Builder(activity).create();
          alertDialog.setTitle("Permission Request");
          if (origin.equals("file://"))
            origin = "This Application";
          alertDialog.setMessage(origin + " would like to access your location.");
          alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Allow",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                theCallback.invoke(theOrigin, true, true);
              } 
            }); 
          alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "Refuse",