11//This Handy-Dandy class acquired and tweaked from http://stackoverflow.com/a/3145655/309558
22package org .wordpress .android .util .helpers ;
33
4+ import android .annotation .SuppressLint ;
45import android .app .Activity ;
56import android .content .Context ;
67import android .location .Location ;
@@ -18,9 +19,8 @@ public class LocationHelper {
1819 boolean mGpsEnabled = false ;
1920 boolean mNetworkEnabled = false ;
2021
22+ @ SuppressLint ("MissingPermission" )
2123 public boolean getLocation (Activity activity , LocationResult result ) {
22-
23-
2424 mLocationResult = result ;
2525 if (mLocationManager == null ) {
2626 mLocationManager = (LocationManager ) activity .getSystemService (Context .LOCATION_SERVICE );
@@ -55,6 +55,7 @@ public boolean getLocation(Activity activity, LocationResult result) {
5555 }
5656
5757 LocationListener locationListenerGps = new LocationListener () {
58+ @ SuppressLint ("MissingPermission" )
5859 public void onLocationChanged (Location location ) {
5960 mTimer .cancel ();
6061 mLocationResult .gotLocation (location );
@@ -73,6 +74,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {
7374 };
7475
7576 LocationListener locationListenerNetwork = new LocationListener () {
77+ @ SuppressLint ("MissingPermission" )
7678 public void onLocationChanged (Location location ) {
7779 mTimer .cancel ();
7880 mLocationResult .gotLocation (location );
@@ -92,6 +94,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {
9294
9395 class GetLastLocation extends TimerTask {
9496 @ Override
97+ @ SuppressLint ("MissingPermission" )
9598 public void run () {
9699 mLocationManager .removeUpdates (locationListenerGps );
97100 mLocationManager .removeUpdates (locationListenerNetwork );
@@ -130,6 +133,7 @@ public static abstract class LocationResult {
130133 public abstract void gotLocation (Location location );
131134 }
132135
136+ @ SuppressLint ("MissingPermission" )
133137 public void cancelTimer () {
134138 if (mTimer != null ) {
135139 mTimer .cancel ();
0 commit comments