NaurtLite class

Initialisation

To use Naurt, first instantiate the NaurtLite class. Only one of these objects should ever be created and therefore a single instance should be passed throughout the app.

Import

Kotlin
import com.naurt.sdk.NaurtLite

Constructor signature

Kotlin
NaurtLite(
    apiKey: String,
    context: Context,
    destinationData: JSONObject? = null
)

Parameters

  • apiKey: Your Naurt API Key.
  • context: The context of your application.
  • destinationData: The data associated with the current destination. Used to automatically generate parking and entrance POIs. Defaults to null.

Returns

An object of type NaurtLite.

Throws

Throws an Exception when initialisation has failed. For example, the correct permissions have not yet been granted.


onDestroy

Called within the onDestroy method of your app. Cleans up resources used by Naurt Lite.

Signature

Kotlin
naurtLite.onDestroy()

Parameters

None

Returns

None

Throws

Does not throw.


newDestination

To associate data to location fixes and POIs being produced by Naurt, use the following method. Either a JSONObject from the built-in "org.json" library can be used or a JSON string. A short explanation of what data is relevant here can be found in the Points of Interest section. Doors and parking spots generated at destinations with this data can then be queried using the POI API.

Signatures

Kotlin
naurtLite.newDestination(metadata: JSONObject)
naurtLite.newDestination(metadata: String)

Parameters

  • metadata: A JSONObject or a string containing data about the destination, e.g., an address.

Returns

Nothing.

Throws

Throws an Exception if the string cannot be converted to a JSONObject.


getDestinationData

Gets the data associated with the current destination.

Signatures

Kotlin
naurtLite.getDestinationData()

Parameters

None

Returns

Optional JSONObject.

Throws

Does not throw


getLastLocation

Gets the last location received by the Naurt Lite SDK. This should not be used for continuous tracking. If continuous tracking is desired please use Naurt's Location Manager SDK.

Signature

Kotlin
naurtLite.getLocation(): Location?

Parameters

None.

Returns

  • Location?: The last location. If one is not available, this will be null.

Throws

Does not throw.


getIsValidated

Check to see if your Naurt API key has been validated. Validation is not an instant process and can take a long time depending on the internet connection of the user. For more information, see our validation explainer.

Signature

Kotlin
naurtLite.getIsValidated(): NaurtValidationStatus

Parameters

None.

Returns

  • NaurtValidationStatus: The Naurt validation status. Can be valid, invalid, or in the process of validating. See for more information.

Throws

Does not throw.


getDeviceID

Get the unique device ID. This is the ID Naurt will associate with the device.

Signature

Kotlin
naurtLocationManager.getDeviceID(): String

Parameters

None.

Returns

  • String: The unique device ID

Throws

Does not throw.