Code example for GeolocationPermissions.Callback

Methods: invoke

        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);
          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",
Stop searching for code, let great code find you!  Add Codota to your java IDE