Nodle SDK - Android API and Configuration
The SDK receives configuration remotely from Nodle servers as well as statically using API calls. The static configuration always takes precedence over the remote configuration.
Nodle SDK Api
To interact with the SDK you need to call the Nodle()
method that will give you an Instance of the INodle class. The following are all the public methods for the Nodle API.
init
public fun
init(context:
Context
)
Initialize the Nodle SDK
Parameters | |
| A Context of the application. This value must never be null. |
Example:
start
public fun
start(public_key:
String
)
Immediately starts the Nodle SDK
Parameters | |
| The application public_key created in Step 1 |
Example:
isStarted
public fun
isStarted():
Boolean
Checks if the Nodle SDK is started
Returns | |
| true if the Nodle SDK is started, false otherwise |
Example:
isScanning
public fun
isScanning():
Boolean
Checks if the Nodle SDK is currently scanning the BLE neighborhood. This is useful if you want to show that the SDK is working.
Returns | |
| true if the Nodle SDK is scanning, false otherwise |
Example:
stop
public fun
stop()
Immediately stops the Nodle SDK
Example:
clear
public fun
clear()
Clear any configs by Nodle SDK
Example:
getVersion
public fun
getVersion():
String
Get the version identifier of the Nodle SDK.
Returns | |
| the current version of the Nodle SDK |
Example:
getEvents
public fun
getEvents():
NodleEvent
Get the raw bluetooth events from the Nodle SDK with the following type:
Returns | |
| Returns NodleBluetoothScanRecord |
| Returns NodleBluetoothEvent |
| Returns NodleBluetoothEvent |
Example of available return event classes below:
Returns | |
| Raw Bluetooth Record from Nodle SDK |
| Bluetooth Event when the SDK start/stop |
Example:
Example Nodle Collector for Java:
Example Nodle Continuation for Java:
The following data can be collected from the NodleEventType
:
Key | Description | Default Value |
| returns nodle bluetooth event type | NodleEventType |
The following data can be collected from the NodleBluetoothScanRecord
:
Key | Description | Default Value |
| returns device unique identifier | String |
| returns received signal strength indicator | Int |
| returns raw bytes of the record | ByteArray |
| returns the manufacturer specific data associated with the manufacturer id | Map<Int, ByteArray> |
| returns an array of services UUID's within the advertisement | List<UUID> |
The following data can be collected from the NodleBluetoothEvent
:
Key | Description | Default Value |
| returns bluetooth scanning state | Boolean |
config
public fun
config(resourceId:
AndroidNodleResourceId
)
public fun <T>
config(key:
String,
value:
T
)
configure the SDK either by supplying a json file located in res/raw/config.json
or by directly configuring a key. An example of a json configuration look like this:
the following are the table of all the keys available and their description:
Key | Description | Default Value |
| duration of a single ble pass in milliseconds. Longer scan increase battery consumption but gives more reward. | 10000 |
| wait time between two ble pass in milliseconds. Longer period reduce battery consumption but gives less reward | 90000 |
| multiplier for the ble scan interval above. | 1 |
| if true, the cellular connexion will be used. if false, only wifi connection will be used. | true |
| if true, our crash reporting will send us crash reports. If false there will be no crash reports to send. | true |
Example:
Last updated