Integration

Log In / Log Out with an externalCode

Before using Live Activities, the device must be registered with your backend using an external identifier:

// Log In
LAIndigitall.login(context, "yourExternalCode", object : LADeviceCallback {
    override fun onSuccess(deviceId: String) {
        Log.d("LiveActivities", "Device registered: $deviceId")
    }

    override fun onError(error: String?) {
        Log.e("LiveActivities", "Login error: $error")
    }
})

// Log Out
LAIndigitall.logOut(context, object : LADeviceCallback {
    override fun onSuccess(deviceId: String) {
        Log.d("LiveActivities", "Device logged out: $deviceId")
    }

    override fun onError(error: String?) {
        Log.e("LiveActivities", "Logout error: $error")
    }
})


List Active Live Activities

You can retrieve the list of active Live Activities associated with the device:

IndigitallLA.getListLiveActivities(context, object : LACallback() {
    override fun onSuccess(liveActivities: ArrayList<LiveActivity>) {
        liveActivities.forEach {
            Log.d("LiveActivity", "ID: ${it.liveActivityId}, Topic: ${it.androidTopicId}")
        }
    }

    override fun onError(errorId: Int?, errorMessage: String?, descriptionMessage: String?) {
        Log.e("LiveActivity", "Error: $errorMessage - $descriptionMessage")
    }
})


Manage Topics (Subscribe / Unsubscribe / List)

Each Live Activity is identified by a unique topic. Use these methods to control which ones the device is subscribed to.

List topics

IndigitallLA.topicList(context, object : LATopicCallback(context) {
    override fun onSuccess(topics: ArrayList<String>?) {
        Log.d("Topics", "Subscribed topics: $topics")
    }

    override fun onError(errorId: Int?, errorMessage: String?, descriptionMessage: String?) {
        Log.e("Topics", "Error: $errorMessage - $descriptionMessage")
    }
})

Subscribe to Topics

val topicsToSubscribe = arrayListOf("order_123", "match_live", "flight_abc")
IndigitallLA.subscribeToTopic(context, topicsToSubscribe, object : LATopicCallback(context) {
    override fun onSuccess(topics: ArrayList<String>?) {
        Log.d("Topics", "Successfully subscribed: $topics")
    }

    override fun onError(errorId: Int?, errorMessage: String?, descriptionMessage: String?) {
        Log.e("Topics", "Subscribe error: $errorMessage - $descriptionMessage")
    }
})


Unsubscribe from Topics

val topicsToUnsubscribe = arrayListOf("order_123")
IndigitallLA.unsubscribeToTopic(context, topicsToUnsubscribe, object : LATopicCallback(context) {
    override fun onSuccess(topics: ArrayList<String>?) {
        Log.d("Topics", "Successfully unsubscribed: $topics")
    }

    override fun onError(errorId: Int?, errorMessage: String?, descriptionMessage: String?) {
        Log.e("Topics", "Unsubscribe error: $errorMessage - $descriptionMessage")
    }
})


Push Notification Behavior

Once subscribed, the server can send:

  • Visible push: Appears as a fixed notification (e.g., "Your delivery is 5 minutes away").
  • Silent push: Triggers background processing or data updates without interrupting the user.

You have full control of:

  • Notification layout
  • Priority and sound
  • Persistence (ongoing)
  • Auto-dismiss logic

Notes

  • Topics allow a 1:1 mapping with live events.
  • This approach is compatible with all modern Android versions.
  • Make sure to handle push reception in your FirebaseMessagingService.

Example of FirebaseMessagingService

class MyFirebaseService: com.indigitall.android.push.services.FirebaseMessagingService() {
    var push: Push ?= null
    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        try {
            val json = JSONObject(remoteMessage.data as Map<String,String>)
            Log.d("firebase json", json.toString())
            push = Push(applicationContext, json)
            val liveActivityPush = LAPush(json)
            if (liveActivityPush.pushType == PushType.LIVE_ACTIVITY) {
                if (liveActivityPush.liveActivityEventType == LAEventType.START) {
                  // start up live activity
                } else if (liveActivityPush.liveActivityEventType == LAEventType.UPDATE) {
                    // update live activity
                } else if (liveActivityPush.liveActivityEventType == LAEventType.END) {
                    // end live activity
                }
            } else {
								// show indigitall notification
                super.onMessageReceived(remoteMessage)
             }
          } catch (exception: Exception) {
              print(exception.message)
          }
        }
    }

    override fun onNewToken(refreshedToken: String) {
        super.onNewToken(refreshedToken)
    }
}