Github user nikhilkh commented on a diff in the pull request:
https://github.com/apache/cordova-android/pull/220#discussion_r40386990
--- Diff: framework/src/org/apache/cordova/CordovaInterfaceImpl.java ---
@@ -161,4 +164,35 @@ public ActivityResultHolder(int requestCode, int
resultCode, Intent intent) {
this.intent = intent;
}
}
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionResult(int requestCode, String[]
permissions,
+ int[] grantResults) throws
JSONException {
+ if(permissionResultCallback != null)
+ {
+
permissionResultCallback.onRequestPermissionResult(requestCode, permissions,
grantResults);
+ permissionResultCallback = null;
+ }
+ }
+
+ public void requestPermission(CordovaPlugin plugin, int requestCode,
String permission) {
+ permissionResultCallback = plugin;
+ String[] permissions = new String [1];
+ permissions[0] = permission;
+ getActivity().requestPermissions(permissions, requestCode);
+ }
+
+ public void requestPermissions(CordovaPlugin plugin, int requestCode)
+ {
+ permissionResultCallback = plugin;
+ String[] permissions = plugin.getPermissionRequest();
--- End diff --
It's kinda odd to have the permission array not being passed along instead
we invoking a callback on plugin to get the permissions. Passing the
permissions array would be a simpler design.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]