Android – Tempo

Tempo allows active tracking of a user’s location, as well as live ETA estimation.

Start Tempo

For this capability, the SDK needs to be initialized and the app must have location permission. You also need Tempo to be enabled for your Bluedot Account and can see the Tempo section in the Projects List page of your Canvas account. If that is not visible and you want to use this capability, please contact your Bluedot CX representative. A foreground service notification is also required.

Tempo also requires Destination IDs to be defined, which you can learn about here.

To start Tempo, you should

TempoService.builder()
    .notificationId(myNotificationId)
     .notification(notificationReference)
     .destinationId("myDestinationId")
     .start(myApplicationContext, // This context should be the Application context
              (error) -> { error != null?Log.d("bluedot", "Error in starting Bluedot Tempo tracking: "+error.getMessage():return; })

Receiving Tempo events

The Tempo service does not issue events under normal operation. Instead, it only issues events if there is an error with the operation. Tracking events are instead delivered via webhook, as configured in the Canvas UI.

class ExampleTempoReceiver : TempoTrackingReceiver() {
    //Called when there is an error that has caused Tempo to stop
    override fun tempoStoppedWithError(error: BDError, context: Context) {
        //error during Tempo 
    }
 }
<application android:label="@string/app_name" >
    <receiver
        android:name="my.package.ExampleTempoReceiver"
        android:enabled="true"
        android:exported="false"
     >
        <intent-filter>
           <action android:name="io.bluedot.point.TEMPO" />
        </intent-filter>
     </receiver>
 </application>

Stop Tempo

Once the Tempo service is no longer needed, you can stop the service.

val tempoStopError: BDError? = TempoService.stop(myContext)
if (tempoStopError != null) {
    // An error occurred, the SDK or Tempo may not have been initialized correctly.
}
Created by Melwin Chiramel on December 21, 2020