Search…
5. Starting Detections
By starting detections, the Sentiance SDK will intelligently detect a user's real-world movements while collecting sensor, location, and motion activity data.
Starting detections is only allowed after a successful initialization. Ideally, this step is done immediately after initialization succeeds, as this will guarantee that the SDK is detecting as early and often as possible.
Call the start() method from the body of OnInitCallback.onInitSuccess():
1
@Override
2
public void onInitSuccess() {
3
Sentiance.getInstance(context).start(new OnStartFinishedHandler() {
4
@Override
5
public void onStartFinished (SdkStatus sdkStatus) {
6
}
7
});
8
}
Copied!
You can pass an OnStartFinishedHandler to the start() method to be notified of the start status. The next section explains about this status and handling general status updates.
The SDK holds a weak reference to the handler to avoid leaking your Activity or app component. Declare the handler at the class level if you want to make sure the callback gets invoked after onInitSuccess returns.
If you want to have more control over when the Sentiance SDK is doing detections, see controlled detections.
Copy link