You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2015/10/28 20:00:45 UTC
[2/6] cordova-plugin-geolocation git commit: Refactored Geolocation
after feedback
Refactored Geolocation after feedback
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/commit/b9426e98
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/b9426e98
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/b9426e98
Branch: refs/heads/master
Commit: b9426e98ac41dfe7f94b3e965e5436424c22595e
Parents: 40d92df
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Sep 30 12:44:01 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Oct 28 12:00:26 2015 -0700
----------------------------------------------------------------------
src/android/Geolocation.java | 31 ++-----------------------------
1 file changed, 2 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/b9426e98/src/android/Geolocation.java
----------------------------------------------------------------------
diff --git a/src/android/Geolocation.java b/src/android/Geolocation.java
index 3eb9974..a04e949 100644
--- a/src/android/Geolocation.java
+++ b/src/android/Geolocation.java
@@ -37,14 +37,7 @@ public class Geolocation extends CordovaPlugin {
String TAG = "GeolocationPlugin";
CallbackContext context;
- String [] permissions;
-
- public Geolocation()
- {
- permissions = new String[2];
- permissions[0] = Manifest.permission.ACCESS_COARSE_LOCATION;
- permissions[1] = Manifest.permission.ACCESS_FINE_LOCATION;
- }
+ String [] permissions = { Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION };
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
@@ -58,17 +51,13 @@ public class Geolocation extends CordovaPlugin {
return true;
}
else {
- cordova.requestPermissions(this, 0);
+ cordova.requestPermissions(this, 0, permissions);
}
return true;
}
return false;
}
- public String[] getPermissionRequest() {
- return permissions;
- }
-
public void onRequestPermissionResult(int requestCode, String[] permissions,
int[] grantResults) throws JSONException
@@ -88,21 +77,5 @@ public class Geolocation extends CordovaPlugin {
context.sendPluginResult(result);
}
- public boolean hasPermisssion() {
- if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
- {
- return true;
- }
- for(String p : permissions)
- {
- if(PackageManager.PERMISSION_DENIED == cordova.getActivity().checkSelfPermission(p))
- {
- return false;
- }
- }
-
- return true;
- }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org