Package com.trx.neon.api.neonSettings
Class NeonSettings
- java.lang.Object
-
- com.trx.neon.api.neonSettings.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 logsstatic boolean
canEnableInternalSensors(android.content.Context context)
Checks whether the current account has permissions and device support for enabling internal sensorsstatic 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 Servicesstatic java.lang.String
getTrackingUnitAddress()
Gets the address of the tracking unitstatic java.lang.String
getTrackingUnitName()
Gets the name of the tracking unitstatic UWBChannelConfig
getUWBConfiguration()
If a valid UWB-enabled tracker is connected, the current UWB configuration can be retrieved for displaystatic boolean
hasTrackingUnit()
Checks whether NEON Location Service has a tracking unit selectedstatic boolean
hasUWBSensors()
Checks whether a UWB-enabled tracking unit is connected.static boolean
isAndroidGPSEnabled()
Checks whether NEON Location Service will use android locationstatic boolean
isIgnoringBatteryOptimizations(android.content.Context context)
Checks whether NEON Location Service is ignoring battery optimizations This is required for tracking with internal sensorsstatic 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 enabledstatic 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 specifiedstatic 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 startstatic 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 Utilitystatic 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 accountstatic boolean
startTrackingUnitActivityForResult(android.app.Activity visibleActivity, int requestCode)
Interact with the user to select a tracking unitstatic 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.
-
-
-
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
-
-
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 finishesrequestCode
- 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 serverendpoint
- 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 interactionrequestCode
- 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 interactionrequestCode
- onActivityResult will be called this requestCodemandatoryUpdate
- 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
-
-