Package 

Class LocationManager


  • 
    public final class LocationManager
    
                        

    Helper class to manage location settings.

    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocationManager

        LocationManager()
    • 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.

      • onDestroy

         final Unit onDestroy()

        Unregisters all listeners and destroys all related instances.

        Invoke this in your activity / fragment onDestroy method.