public class GetLocation
extends java.lang.Object
implements android.location.LocationListener
Modifier and Type | Class and Description |
---|---|
static interface |
GetLocation.LocationCallback
Interface to be implemented by the calling class if it wants to receive the result
returns current location of the device if available null if not available
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOCATION_ALERT_PERMISSION_TIME_PREFERENCE |
static java.lang.String |
LOCATION_ALERT_PREFERENCE |
static java.lang.String |
LOCATION_ALERT_TIME_PREFERENCE |
Constructor and Description |
---|
GetLocation(android.content.Context context,
GetLocation.LocationCallback callback,
FragmentActivity activity) |
Modifier and Type | Method and Description |
---|---|
void |
getLocation()
Method tries to get current location
else shows an alert to enable location services (if user has not disabled reminder
or 24hrs have not passed since the last reminder)
|
void |
onLocationChanged(android.location.Location location) |
void |
onProviderDisabled(java.lang.String provider) |
void |
onProviderEnabled(java.lang.String provider) |
void |
onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults) |
void |
onResume() |
void |
onStatusChanged(java.lang.String provider,
int status,
android.os.Bundle extras) |
void |
onStop() |
void |
showSettingsAlert()
method to display alert asking the user to enable location services
|
void |
stopUsingLocationListener()
Function to stop listening to Location Listener
|
public static final java.lang.String LOCATION_ALERT_PREFERENCE
public static final java.lang.String LOCATION_ALERT_TIME_PREFERENCE
public static final java.lang.String LOCATION_ALERT_PERMISSION_TIME_PREFERENCE
public GetLocation(android.content.Context context, GetLocation.LocationCallback callback, FragmentActivity activity)
public void getLocation()
public void stopUsingLocationListener()
public void showSettingsAlert()
public void onLocationChanged(android.location.Location location)
onLocationChanged
in interface android.location.LocationListener
public void onStatusChanged(java.lang.String provider, int status, android.os.Bundle extras)
onStatusChanged
in interface android.location.LocationListener
public void onProviderEnabled(java.lang.String provider)
onProviderEnabled
in interface android.location.LocationListener
public void onProviderDisabled(java.lang.String provider)
onProviderDisabled
in interface android.location.LocationListener
public void onResume()
public void onStop()
public void onRequestPermissionsResult(int requestCode, java.lang.String[] permissions, int[] grantResults)