Class NeonSettings


  • public class NeonSettings
    extends java.lang.Object
    The main entry point for integrating Neon Settings Services into your application.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACTIVITY_SETTINGS
      Start this activity to let user manage Neon's preferences in a standard way
    • Constructor Summary

      Constructors 
      Constructor Description
      NeonSettings()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addUserLabel​(java.lang.String userLabel)
      Adds a user label to identify the tracked entity in any logs
      static boolean canEnableInternalSensors​(android.content.Context context)
      Checks whether the current account has permissions and device support for enabling internal sensors
      static void enableAndroidGPS​(boolean useGPS)
      NEON Location Service will use android location if that service is enabled on the phone.
      static NeonAccount getLoginInfo()
      Gets account information.
      static java.lang.String getNeonLocationServicesVersion​(android.content.Context context)
      Gets the version for NEON Location Services
      static java.lang.String getTrackingUnitAddress()
      Gets the address of the tracking unit
      static java.lang.String getTrackingUnitName()
      Gets the name of the tracking unit
      static UWBChannelConfig getUWBConfiguration()
      If a valid UWB-enabled tracker is connected, the current UWB configuration can be retrieved for display
      static boolean hasTrackingUnit()
      Checks whether NEON Location Service has a tracking unit selected
      static boolean hasUWBSensors()
      Checks whether a UWB-enabled tracking unit is connected.
      static boolean isAndroidGPSEnabled()
      Checks whether NEON Location Service will use android location
      static boolean isIgnoringBatteryOptimizations​(android.content.Context context)
      Checks whether NEON Location Service is ignoring battery optimizations This is required for tracking with internal sensors
      static boolean isStatusNotificationMinimized()
      For integrators that want NEON tracking information to be as minimal as possible use this to minimize the information shown in the status notification bar at the top of the screen.
      static boolean isTrackingEnabled()
      Checks whether tracking is enabled
      static void login​(java.lang.String apiKey)
      Logs in with the specified API Key to the NEON cloud.
      static void login​(java.lang.String apiKey, java.lang.String endpoint)
      Logs in with an API Key to a NEON Enterprise server located at the endpoint specified
      static void minimizeStatusNotification​(boolean minimize)
      For integrators that want NEON tracking information to be as minimal as possible use this to minimize the information shown in the status notification bar at the top of the screen.
      static void setAndEnableInternalSensors​(android.content.Context context)
      Sets and enables internal sensors on the phone This requires the internal sensors feature on your subscription, a phone with HiFi sensors of API23 or greater, and battery optimization turned off for the app, or tracking will fail to start
      static void setAndEnableTrackingUnit​(java.lang.String btAddress)
      Sets the tracking unit specified by the bluetooth address string and enables tracking.
      static boolean setUWBConfiguration​(UWBChannelConfig channelConfig)
      If a valid UWB-enabled tracker is connected, the UWB can be configured with a UWBChannelConfig object.
      static void startBeaconUpdateUtility​(android.app.Activity visibleActivity)
      Interact with the user to update remote beacons in range with the Beacon Update Utility
      static boolean startIgnoreBatteryOptimizationsActivity​(android.app.Activity visibleActivity)
      Will start a dialog requesting to turn off battery optimizations for NEON Location Service.
      static boolean startLoginActivityForResult​(int requestCode, android.app.Activity visibleActivity)
      Starts the LoginActivity, where users can login using their email and password or a google account
      static boolean startTrackingUnitActivityForResult​(android.app.Activity visibleActivity, int requestCode)
      Interact with the user to select a tracking unit
      static void upgradeNeonLocationServices​(android.app.Activity visibleActivity)
      Interact with the user to download and install a new version of the Neon Location Services.
      static void upgradeNeonLocationServices​(android.app.Activity visibleActivity, int requestCode, boolean mandatoryUpdate)
      Interact with the user to download and install a new version of the Neon Location Services.
      • Methods inherited from class java.lang.Object

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

      • ACTIVITY_SETTINGS

        public static final java.lang.String ACTIVITY_SETTINGS
        Start this activity to let user manage Neon's preferences in a standard way
        See Also:
        Constant Field Values
    • Constructor Detail

      • NeonSettings

        public NeonSettings()
    • Method Detail

      • startLoginActivityForResult

        public static boolean startLoginActivityForResult​(int requestCode,
                                                          android.app.Activity visibleActivity)
        Starts the LoginActivity, where users can login using their email and password or a google account
        Parameters:
        visibleActivity - onActivityResult will be called on this Activity when the Login Activity finishes
        requestCode - onActivityResult will be called this requestCode
        Returns:
        false if the LoginActivity could not be started, true otherwise in onActivityResult for this requestCode, if the resultCode is Activity.RESULT_CANCELED then the login was not done (pressed back button), if the resultCode is Activity.RESULT_OK then the login was successful and the account information is available via the data passed in onActivityResult : Bundle extras = data.getExtras(); Account account = extras.getParcelable("account");
      • login

        public static void login​(java.lang.String apiKey)
        Logs in with the specified API Key to the NEON cloud. An API key can be generated for a subscription on the website.
        Parameters:
        apiKey - An api key for the NEON cloud
      • login

        public static void login​(java.lang.String apiKey,
                                 java.lang.String endpoint)
        Logs in with an API Key to a NEON Enterprise server located at the endpoint specified
        Parameters:
        apiKey - An api key for a NEON Enterprise server
        endpoint - The specified endpoint for the NEON Enterprise server
      • getLoginInfo

        public static NeonAccount getLoginInfo()
        Gets account information. User must be logged in
      • startTrackingUnitActivityForResult

        public static boolean startTrackingUnitActivityForResult​(android.app.Activity visibleActivity,
                                                                 int requestCode)
        Interact with the user to select a tracking unit
        Parameters:
        visibleActivity - A resumed Activity context used to start the interaction
        requestCode - onActivityResult will be called this requestCode
        Returns:
        true if the activity was started successsfully
      • isTrackingEnabled

        public static boolean isTrackingEnabled()
        Checks whether tracking is enabled
        Returns:
        true if tracking is enabled, false if tracking unit is not connected
      • hasTrackingUnit

        public static boolean hasTrackingUnit()
        Checks whether NEON Location Service has a tracking unit selected
        Returns:
        true if a tracking unit is selected, false otherwise
      • getTrackingUnitName

        public static java.lang.String getTrackingUnitName()
        Gets the name of the tracking unit
        Returns:
        tracking unit name
      • getTrackingUnitAddress

        public static java.lang.String getTrackingUnitAddress()
        Gets the address of the tracking unit
        Returns:
        the bluetooth address string for tracking units
      • setAndEnableTrackingUnit

        public static void setAndEnableTrackingUnit​(java.lang.String btAddress)
        Sets the tracking unit specified by the bluetooth address string and enables tracking. This will fail if the NEON Location Service is already tracking
        Parameters:
        btAddress - - string mac address from BluetoothDevice.getAddress()
      • canEnableInternalSensors

        public static boolean canEnableInternalSensors​(android.content.Context context)
        Checks whether the current account has permissions and device support for enabling internal sensors
        Parameters:
        context - A context for permissions checking
        Returns:
        true if permissions have been granted, false otherwise
      • startIgnoreBatteryOptimizationsActivity

        public static boolean startIgnoreBatteryOptimizationsActivity​(android.app.Activity visibleActivity)
        Will start a dialog requesting to turn off battery optimizations for NEON Location Service. This is required for tracking with internal sensors
        Parameters:
        visibleActivity - A resumed Activity context used to start the interaction
        Returns:
        true if the activity was successfully started
      • isIgnoringBatteryOptimizations

        public static boolean isIgnoringBatteryOptimizations​(android.content.Context context)
        Checks whether NEON Location Service is ignoring battery optimizations This is required for tracking with internal sensors
        Parameters:
        context - A context for permissions checking
        Returns:
        true if permissions have been granted, false otherwise
      • setAndEnableInternalSensors

        public static void setAndEnableInternalSensors​(android.content.Context context)
        Sets and enables internal sensors on the phone This requires the internal sensors feature on your subscription, a phone with HiFi sensors of API23 or greater, and battery optimization turned off for the app, or tracking will fail to start
      • startBeaconUpdateUtility

        public static void startBeaconUpdateUtility​(android.app.Activity visibleActivity)
        Interact with the user to update remote beacons in range with the Beacon Update Utility
        Parameters:
        visibleActivity - A resumed Activity context used to start the interaction
      • upgradeNeonLocationServices

        public static void upgradeNeonLocationServices​(android.app.Activity visibleActivity)
        Interact with the user to download and install a new version of the Neon Location Services.
        Parameters:
        visibleActivity - A resumed Activity context used to start the interaction
      • upgradeNeonLocationServices

        public static void upgradeNeonLocationServices​(android.app.Activity visibleActivity,
                                                       int requestCode,
                                                       boolean mandatoryUpdate)
        Interact with the user to download and install a new version of the Neon Location Services.
        Parameters:
        visibleActivity - A resumed Activity context used to start the interaction
        requestCode - onActivityResult will be called this requestCode
        mandatoryUpdate - update will be mandatory
      • getNeonLocationServicesVersion

        public static java.lang.String getNeonLocationServicesVersion​(android.content.Context context)
        Gets the version for NEON Location Services
        Returns:
        the version
      • hasUWBSensors

        public static boolean hasUWBSensors()
        Checks whether a UWB-enabled tracking unit is connected. If not, UWB cannot be configured.
        Returns:
        true if a UWB-enabled tracking unit is connected
      • setUWBConfiguration

        public static boolean setUWBConfiguration​(UWBChannelConfig channelConfig)
        If a valid UWB-enabled tracker is connected, the UWB can be configured with a UWBChannelConfig object. UWB configuration is required to drop UWB Beacons and share locations through the UWB network.
        Parameters:
        channelConfig - A UWB channel configuration
        Returns:
        true if the UWB configuration was set successfully
      • getUWBConfiguration

        public static UWBChannelConfig getUWBConfiguration()
        If a valid UWB-enabled tracker is connected, the current UWB configuration can be retrieved for display
        Returns:
        UWBChannelConfig with the current UWB configuration parameters
      • enableAndroidGPS

        public static void enableAndroidGPS​(boolean useGPS)
        NEON Location Service will use android location if that service is enabled on the phone. This flag can be used to disable GPS in areas where it unreliable and use inertial and beacons only
        Parameters:
        useGPS - Whether to use android-provided GPS locations or ignore them
      • isAndroidGPSEnabled

        public static boolean isAndroidGPSEnabled()
        Checks whether NEON Location Service will use android location
        Returns:
        true if android-provided GPS locations should be used in NEON Location Service
      • minimizeStatusNotification

        public static void minimizeStatusNotification​(boolean minimize)
        For integrators that want NEON tracking information to be as minimal as possible use this to minimize the information shown in the status notification bar at the top of the screen. There needs to be a persistent notification in order for tracking to work, but this will simply have a icon and NEON Location Service and won't open the settings activity when pressed.
        Parameters:
        minimize - Whether to show the full status notification bar or the minimal one
      • isStatusNotificationMinimized

        public static boolean isStatusNotificationMinimized()
        For integrators that want NEON tracking information to be as minimal as possible use this to minimize the information shown in the status notification bar at the top of the screen. There needs to be a persistent notification in order for tracking to work, but this will simply have a icon and NEON Location Service and won't open the settings activity when pressed.
        Returns:
        true if status notification is minimized
      • addUserLabel

        public static void addUserLabel​(java.lang.String userLabel)
        Adds a user label to identify the tracked entity in any logs
        Parameters:
        userLabel - identifying name