Class WeatherLocationManager
- java.lang.Object
-
- de.kaffeemitkoffein.tinyweatherforecastgermany.WeatherLocationManager
-
public class WeatherLocationManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
GPSFIXINTERVAL
static int
PERMISSION_CALLBACK_LOCATION
-
Constructor Summary
Constructors Constructor Description WeatherLocationManager(Context context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
checkForBackgroundLocation(Context context)
checks for a new location using known locations, meaning that no active location search is triggered.void
checkLocation()
static Weather.WeatherLocation
findClosestStation(Context context, Location location)
static java.lang.String
getDescriptionAlternate(Context context, Weather.WeatherLocation weatherLocation)
static java.lang.String
getDescriptionGeo(Weather.WeatherLocation weatherLocation)
static Location
getLastKnownLocation(Context context)
static boolean
hasBackgroundLocationPermission(Context context)
static boolean
hasLocationPermission(Context context)
void
newLocation(Location location)
void
onActivityCreated(Activity activity, Bundle bundle)
void
onActivityDestroyed(Activity activity)
void
onActivityPaused(Activity activity)
void
onActivityResumed(Activity activity)
void
onActivitySaveInstanceState(Activity activity, Bundle bundle)
void
onActivityStarted(Activity activity)
void
onActivityStopped(Activity activity)
void
registerCancelButton(Button cancelButton)
void
setView(RelativeLayout relativeLayout)
void
startGPSLocationSearch()
void
stopGPSLocationSearch()
-
-
-
Field Detail
-
GPSFIXINTERVAL
public static final int GPSFIXINTERVAL
- See Also:
- Constant Field Values
-
PERMISSION_CALLBACK_LOCATION
public static final int PERMISSION_CALLBACK_LOCATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
setView
public void setView(RelativeLayout relativeLayout)
-
registerCancelButton
public void registerCancelButton(Button cancelButton)
-
onActivityCreated
public void onActivityCreated(Activity activity, Bundle bundle)
-
onActivityStarted
public void onActivityStarted(Activity activity)
-
onActivityResumed
public void onActivityResumed(Activity activity)
-
onActivityPaused
public void onActivityPaused(Activity activity)
-
onActivityStopped
public void onActivityStopped(Activity activity)
-
onActivitySaveInstanceState
public void onActivitySaveInstanceState(Activity activity, Bundle bundle)
-
onActivityDestroyed
public void onActivityDestroyed(Activity activity)
-
hasLocationPermission
public static boolean hasLocationPermission(Context context)
-
hasBackgroundLocationPermission
public static boolean hasBackgroundLocationPermission(Context context)
-
getLastKnownLocation
public static Location getLastKnownLocation(Context context)
-
checkForBackgroundLocation
public static boolean checkForBackgroundLocation(Context context)
checks for a new location using known locations, meaning that no active location search is triggered. Requires the location background permission.- Parameters:
context
-- Returns:
- true if a new station was set, otherwise false (including not granted permission)
-
findClosestStation
public static Weather.WeatherLocation findClosestStation(Context context, Location location)
-
getDescriptionGeo
public static java.lang.String getDescriptionGeo(Weather.WeatherLocation weatherLocation)
-
getDescriptionAlternate
public static java.lang.String getDescriptionAlternate(Context context, Weather.WeatherLocation weatherLocation)
-
startGPSLocationSearch
public void startGPSLocationSearch()
-
stopGPSLocationSearch
public void stopGPSLocationSearch()
-
checkLocation
public void checkLocation()
-
newLocation
public void newLocation(Location location)
-
-