Class LocationHandler


  • public class LocationHandler
    extends java.lang.Object
    Handles location permissions and retrieving the location of the player's device. Used to set the location of a QRCode.
    • Field Detail

      • REQUEST_CODE_PERMISSIONS

        public static final int REQUEST_CODE_PERMISSIONS
        See Also:
        Constant Field Values
      • LOCATION_PERMISSIONS

        public static final java.lang.String[] LOCATION_PERMISSIONS
    • Constructor Detail

      • LocationHandler

        public LocationHandler​(androidx.fragment.app.Fragment fragment)
        Creates a new LocationHandler
        Parameters:
        fragment - The fragment that will use the user's location
        See Also:
        QRCodeFragment
    • Method Detail

      • setQrToLastLocation

        public void setQrToLastLocation​(QRCode qrCode)
        Sets the provided QRCode to the device's last known location
        Parameters:
        qrCode - The QRCode to set the location of.
      • addLocation

        public void addLocation​(QRCode qrCode)
        Adds current location to the list of QR Codes.
        Parameters:
        qrCode - The QRCode to add current location to.
      • removeLastAddedLocation

        public void removeLastAddedLocation​(QRCode qrCode)
        Removes the most-recently added location from the QR code
        Parameters:
        qrCode - The QRCode to remove location from
      • locationPermissionsGranted

        public boolean locationPermissionsGranted()
        Checks if at least one of the location permissions was granted.
        Returns:
        True if the user has granted access to either FINE or COARSE location, False otherwise.