From 9946613ba13e6eb7c0cc4f225856c01332ddc581 Mon Sep 17 00:00:00 2001 From: Manuel Beck Date: Wed, 6 May 2026 12:23:42 +0200 Subject: [PATCH 1/2] doc: improve documentation of `onRequestPermissionResult` and `onRequestPermissionsResult` - Make clear, that these methods are not only called, when the user grants permissions, but also when he denies them or the request was interrupted. - Add note, how the call chain ist - Make clear, that `onRequestPermissionResult` is legacy and should not be used anymore - Add Android Developer documentation link for the new `onRequestPermissionsResult` --- framework/src/org/apache/cordova/CordovaPlugin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java index 6cd9b0560..790f5034b 100644 --- a/framework/src/org/apache/cordova/CordovaPlugin.java +++ b/framework/src/org/apache/cordova/CordovaPlugin.java @@ -416,7 +416,11 @@ public boolean hasPermisssion() { } /** - * Called by the system when the user grants permissions + * Forwarded system call to {@link CordovaActivity#onRequestPermissionsResult(int, String[], int[])} + * and from there to the plugin that requested permissions, when the user granted them, denied them, + * or when the request was interrupted. + * This is a legacy method that will be called if a plugin overrides it, + * but new plugins should override {@link #onRequestPermissionsResult} instead. * * @param requestCode * @param permissions @@ -430,11 +434,14 @@ public void onRequestPermissionResult(int requestCode, String[] permissions, } /** - * Called by the system when the user grants permissions + * Forwarded system call to {@link CordovaActivity#onRequestPermissionsResult(int, String[], int[])} + * and from there to the plugin that requested permissions, when the user granted them, denied them, + * or when the request was interrupted. * * @param requestCode * @param permissions * @param grantResults + * @see https://developer.android.com/reference/android/app/Activity#onRequestPermissionsResult(int,%20java.lang.String[],%20int[]) */ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException { From 869e68504e5614417e8d5013b00c0d6b1ea49418 Mon Sep 17 00:00:00 2001 From: Manuel Beck Date: Wed, 6 May 2026 12:25:08 +0200 Subject: [PATCH 2/2] doc: improve documentation - Forgot to commit everything --- .../src/org/apache/cordova/CordovaPlugin.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java index 790f5034b..ff5cad4cd 100644 --- a/framework/src/org/apache/cordova/CordovaPlugin.java +++ b/framework/src/org/apache/cordova/CordovaPlugin.java @@ -416,11 +416,14 @@ public boolean hasPermisssion() { } /** - * Forwarded system call to {@link CordovaActivity#onRequestPermissionsResult(int, String[], int[])} - * and from there to the plugin that requested permissions, when the user granted them, denied them, - * or when the request was interrupted. - * This is a legacy method that will be called if a plugin overrides it, - * but new plugins should override {@link #onRequestPermissionsResult} instead. + * Forwarded system call to the plugin when the user grants permissions, + * denies them or the request was interrupted. + * This is a legacy method and should not be used anymore. + * Instead {@link #onRequestPermissionsResult} should be used. + * + * Note: The system calls {@link CordovaActivity#onRequestPermissionsResult(int, String[], int[])}, + * which calls {@link CordovaInterfaceImpl#onRequestPermissionsResult(int, String[], int[])}, + * and finally this method. * * @param requestCode * @param permissions @@ -434,9 +437,12 @@ public void onRequestPermissionResult(int requestCode, String[] permissions, } /** - * Forwarded system call to {@link CordovaActivity#onRequestPermissionsResult(int, String[], int[])} - * and from there to the plugin that requested permissions, when the user granted them, denied them, - * or when the request was interrupted. + * Forwarded system call to the plugin when the user grants permissions, + * denies them or the request was interrupted. + * + * Note: The system calls {@link CordovaActivity#onRequestPermissionsResult(int, String[], int[])}, + * which calls {@link CordovaInterfaceImpl#onRequestPermissionsResult(int, String[], int[])}, + * and finally this method. * * @param requestCode * @param permissions