mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-30 00:00:04 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fc9f8a20fb | |||
| 6b4addad66 |
@@ -416,14 +416,7 @@ public class CordovaPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Called by the system when the user grants permissions
|
||||
*
|
||||
* @param requestCode
|
||||
* @param permissions
|
||||
@@ -437,17 +430,11 @@ public class CordovaPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Called by the system when the user grants permissions
|
||||
*
|
||||
* @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 {
|
||||
|
||||
@@ -18,12 +18,6 @@
|
||||
*/
|
||||
package org.apache.cordova;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
/**
|
||||
* This class is permission helper class when compiling against older versions of cordova-android pre 5.0.0
|
||||
* and provides reflective methods for permission requesting and checking so that plugins
|
||||
@@ -38,6 +32,7 @@ import android.content.pm.PackageManager;
|
||||
* @deprecated As of cordova-android 5.0.0, this class is no longer needed and will be removed in a future release.
|
||||
* You can call directly into {@link CordovaInterface} methods instead with {@link CordovaPlugin#cordova}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class PermissionHelper {
|
||||
/**
|
||||
* Requests a "dangerous" permission for the application at runtime. This is a helper method
|
||||
@@ -48,8 +43,9 @@ public class PermissionHelper {
|
||||
* @param requestCode A requestCode to be passed to the plugin's onRequestPermissionResult()
|
||||
* along with the result of the permission request
|
||||
* @param permission The permission to be requested
|
||||
* @deprecated As of cordova-android 5.0.0, use {@link CordovaInterface#requestPermission()} instead.
|
||||
* @deprecated As of cordova-android 5.0.0, use {@link CordovaInterface#requestPermission(CordovaPlugin, int, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void requestPermission(CordovaPlugin plugin, int requestCode, String permission) {
|
||||
PermissionHelper.requestPermissions(plugin, requestCode, new String[] {permission});
|
||||
}
|
||||
@@ -63,8 +59,9 @@ public class PermissionHelper {
|
||||
* @param requestCode A requestCode to be passed to the plugin's onRequestPermissionResult()
|
||||
* along with the result of the permissions request
|
||||
* @param permissions The permissions to be requested
|
||||
* @deprecated As of cordova-android 5.0.0, use {@link CordovaInterface#requestPermissions()} instead.
|
||||
* @deprecated As of cordova-android 5.0.0, use {@link CordovaInterface#requestPermissions(CordovaPlugin, int, String[])} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void requestPermissions(CordovaPlugin plugin, int requestCode, String[] permissions) {
|
||||
plugin.cordova.requestPermissions(plugin, requestCode, permissions);
|
||||
}
|
||||
@@ -77,8 +74,9 @@ public class PermissionHelper {
|
||||
* @param plugin The plugin the permission is being checked against
|
||||
* @param permission The permission to be checked
|
||||
* @return True if the permission has already been granted and false otherwise
|
||||
* @deprecated As of cordova-android 5.0.0, use {@link CordovaInterface#hasPermission()} instead.
|
||||
* @deprecated As of cordova-android 5.0.0, use {@link CordovaInterface#hasPermission(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean hasPermission(CordovaPlugin plugin, String permission) {
|
||||
return plugin.cordova.hasPermission(permission);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user