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.

SDK API

getNoodles

public long getNoodles(Context context)

Return the number of noodles detected by the SDK.

Parameters

context

Context: a Context of the application. This value must never be null.

Returns

long

return the number of noodles detected by the SDK

Example:

long nbNoodles = Nodle.getNoodles(this);

sdkEvent

public Observable<SdkEvent> sdkEvent()

Let the host app registers to an observable stream of sdk events.

Returns

Observable<SdkEvent>

a RxJava Observable stream of Sdk Events

Note that there are three events available:

  • scan started: the event will be of type BleScanStarted

  • beacon scanned: the event will be of type BeaconScannedEvent

  • scan stopped: the event will be of type BleScanStopped

In the case of BeaconScannedEvent, the event also carry information about the scanned device such as mac address and rssi.

Example:

disposable = Nodle.sdkEvent()
.subscribe(
sdkevent -> Log.d(TAG, "SDKEvent: " + sdkevent.toString())
);

Basic Configuration

setNetworkModeWifiOnly

public void setNetworkModeWifiOnly (Context context, boolean enabled)

When enable, wifi offloading will only make network calls when connected to WiFi. You can enable and disable it like so:

Parameters

context

Context: a Context of the application. This value must never be null.

enabled

Boolean: if set to true, the sdk will operate with wifi only. if set to false it will use any connection available .

Example:

Nodle.setNetworkModeWifiOnly(this, true);

enableNotification

public void enableNotification (Context context, boolean enabled)

When enable, display a little notification icon each time the sdk is working in the background:

Parameters

context

Context: a Context of the application. This value must never be null.

enabled

Boolean: if set to true, a notification will appear while the sdk works in the background.

Example:

Nodle.enableNotification(this, true);

Expert Configuration

continuousScanning

public void continuousScanning (Context context, boolean enabled)

When enabled, the SDK will scan continuously, this is not recommended to do unless you know what you are doing. When disabled (default behaviour), the sdk will use the default scanning frequency.

Parameters

context

Context: a Context of the application. This value must never be null.

enabled

Boolean: if set to true, the sdk will scan continuously. if set to false it will use default scanning frequency

Example:

Nodle.continuousScanning(this, true);

liveReporting

public void liveReporting (Context context, boolean enabled)

When enabled, the SDK will act as a live gateway, this is not recommended to do unless you know what you are doing. When disabled (default behaviour), the sdk works on a delay tolerant network fashion. Note that when liveReporting is enabled, the setNetworkModeWifiOnly is ignored.

Parameters

context

Context: a Context of the application. This value must never be null.

enabled

Boolean: if set to true, the sdk will act as a live gateway. if set to false it will work in a dtn fashion.

Example:

Nodle.liveReporting(this, true);

setTrackingModeStatic

public void setTrackingModeStatic (Context context, boolean enabled)

This is disabled by default as Nodle does not track device by periodically randomizing the device id. When enabled, the SDK will use a static ID to identify the current device. Note that to turn this feature on, this option must be set on both the sdk configuration and console configuration.

Parameters

context

Context: a Context of the application. This value must never be null.

enabled

Boolean: if set to true, the sdk will use a static id to identify the host device. if set to false (default), the device id is randomized.

Example:

Nodle.setTrackingModeStatic(this, true);