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.
Last updated
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.
Last updated
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.
public fun
init(context:
Context
)
Initialize the Nodle SDK
Example:
public fun
start(public_key:
String
)
Immediately starts the Nodle SDK
Example:
public fun
isStarted():
Boolean
Checks if the Nodle SDK is started
Example:
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.
Example:
public fun
stop()
Immediately stops the Nodle SDK
Example:
public fun
clear()
Clear any configs by Nodle SDK
Example:
public fun
getVersion():
String
Get the version identifier of the Nodle SDK.
Example:
public fun
getEvents():
NodleEvent
Get the raw bluetooth events from the Nodle SDK with the following type:
Example of available return event classes below:
Example:
Example Nodle Collector for Java:
Example Nodle Continuation for Java:
The following data can be collected from the NodleEventType
:
The following data can be collected from the NodleBluetoothScanRecord
:
The following data can be collected from the NodleBluetoothEvent
:
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:
Example:
Parameters
context
A Context of the application. This value must never be null.
Parameters
public_key
The application public_key created in Step 1
Returns
boolean
true if the Nodle SDK is started, false otherwise
Returns
boolean
true if the Nodle SDK is scanning, false otherwise
Returns
String
the current version of the Nodle SDK
Returns
NodleEventType.BlePayloadEvent
Returns NodleBluetoothScanRecord
NodleEventType.BleStartSearching
Returns NodleBluetoothEvent
NodleEventType.BleStopSearching
Returns NodleBluetoothEvent
Returns
NodleBluetoothScanRecord
Raw Bluetooth Record from Nodle SDK
NodleBluetoothEvent
Bluetooth Event when the SDK start/stop
Key
Description
Default Value
type
returns nodle bluetooth event type
NodleEventType
Key
Description
Default Value
device
returns device unique identifier
String
rssi
returns received signal strength indicator
Int
bytes
returns raw bytes of the record
ByteArray
manufacturerSpecificData
returns the manufacturer specific data associated with the manufacturer id
Map<Int, ByteArray>
servicesUuids
returns an array of services UUID's within the advertisement
List<UUID>
Key
Description
Default Value
scanning
returns bluetooth scanning state
Boolean
Key
Description
Default Value
ble.scan.duration-msec
duration of a single ble pass in milliseconds. Longer scan increase battery consumption but gives more reward.
10000
ble.scan.interval-msec
wait time between two ble pass in milliseconds. Longer period reduce battery consumption but gives less reward
90000
ble.scan.interval-x-factor
multiplier for the ble scan interval above.
1
dtn.use-cellular
if true, the cellular connexion will be used. if false, only wifi connection will be used.
true
sentry.enabled
if true, our crash reporting will send us crash reports. If false there will be no crash reports to send.
true