-
public final class LocationManager
Helper class to manage location settings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
LocationManager.Companion
-
Constructor Summary
Constructors Constructor Description LocationManager()
-
Method Summary
Modifier and Type Method Description final Unit
registerEnableListener(ComponentActivity componentActivity, Function0<Unit> onSuccess, Function0<Unit> onFailure)
Registers a listener for location requests. final Unit
registerEnableListener(Fragment fragment, Function0<Unit> onSuccess, Function0<Unit> onFailure)
Registers a listener for location requests. final Unit
requestEnable()
Launches intent to ask user for turning on their location. final Unit
onDestroy()
Unregisters all listeners and destroys all related instances. -
-
Method Detail
-
registerEnableListener
final Unit registerEnableListener(ComponentActivity componentActivity, Function0<Unit> onSuccess, Function0<Unit> onFailure)
Registers a listener for location requests.
This must only be called once.
Recommended calling this method in your activity's onCreate method.
- Parameters:
componentActivity
- ComponentActivity instance.onSuccess
- Callback when user turns on their location.onFailure
- Callback when user does not turn on their location.
-
registerEnableListener
final Unit registerEnableListener(Fragment fragment, Function0<Unit> onSuccess, Function0<Unit> onFailure)
Registers a listener for location requests.
This must only be called once.
Recommended calling this method in your fragment's onCreateView method.
- Parameters:
fragment
- Fragment instance.onSuccess
- Callback when user turns on their location.onFailure
- Callback when user does not turn on their location.
-
requestEnable
final Unit requestEnable()
Launches intent to ask user for turning on their location.
This will open the settings view of the application.
-
-
-
-