Skip to content

Commit

Permalink
suppress lint on missing permission
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Nov 19, 2015
1 parent 8f5dba9 commit 19786e0
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//This Handy-Dandy class acquired and tweaked from http://stackoverflow.com/a/3145655/309558
package org.wordpress.android.util.helpers;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
Expand All @@ -18,9 +19,8 @@ public class LocationHelper {
boolean mGpsEnabled = false;
boolean mNetworkEnabled = false;

@SuppressLint("MissingPermission")
public boolean getLocation(Activity activity, LocationResult result) {


mLocationResult = result;
if (mLocationManager == null) {
mLocationManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE);
Expand Down Expand Up @@ -55,6 +55,7 @@ public boolean getLocation(Activity activity, LocationResult result) {
}

LocationListener locationListenerGps = new LocationListener() {
@SuppressLint("MissingPermission")
public void onLocationChanged(Location location) {
mTimer.cancel();
mLocationResult.gotLocation(location);
Expand All @@ -73,6 +74,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {
};

LocationListener locationListenerNetwork = new LocationListener() {
@SuppressLint("MissingPermission")
public void onLocationChanged(Location location) {
mTimer.cancel();
mLocationResult.gotLocation(location);
Expand All @@ -92,6 +94,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {

class GetLastLocation extends TimerTask {
@Override
@SuppressLint("MissingPermission")
public void run() {
mLocationManager.removeUpdates(locationListenerGps);
mLocationManager.removeUpdates(locationListenerNetwork);
Expand Down Expand Up @@ -130,6 +133,7 @@ public static abstract class LocationResult {
public abstract void gotLocation(Location location);
}

@SuppressLint("MissingPermission")
public void cancelTimer() {
if (mTimer != null) {
mTimer.cancel();
Expand Down

0 comments on commit 19786e0

Please sign in to comment.