Skip to main content
All CollectionsImportant Actions and Informations
How to Integrate Pulsus Identifier Capture into Apps
How to Integrate Pulsus Identifier Capture into Apps
Updated this week

This document aims to clarify how to integrate applications for capturing the Pulsus identifier. Below is a tutorial for technical implementation to facilitate the integration.

1. Declare a broadcast receiver to obtain the Pulsus Identifier

Declare the broadcast receiver with the action mobi.pulsus.PULSUS_ID in the AndroidManifest.xml file.

This will be responsible for receiving the Pulsus Identifier.

Here is an example code snippet:

<receiver android:name=".broadcast.PulsusIdReceiver">
<intent-filter>
<action android:name="mobi.pulsus.PULSUS_ID" />
</intent-filter>
</receiver>

From Android 8 onwards, it is necessary to register the BroadcastReceiver at runtime.

Here is an example code snippet:

registerReceiver(PulsusIdReceiver(), IntentFilter("mobi.pulsus.PULSUS_ID"))

2. Retrieve/Capture Pulsus Identifier

With the Broadcast declared in the AndroidManifest.xml file, we can now capture the information.

Through the intent, we can search in extras (key-value map) for the key PULSUS_ID.

Here is an example code snippet:

class PulsusIdReceiver: BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?_ {
val pulsusId = intent?.extras?.getString("PULSUS_ID") Toast.makeText(context, pulsusId, Toast.LENGTH_LONG).show()
}
}

3. Request Pulsus Identifier

Finally, we can request the identifier from the Pulsus Agent, which will be received by the BroadcastReceiver declared previously.

To request the identifier, call the sendBroadcast() method, passing the intent with the action: mobi.pulsus.REQUEST_PULSUS_ID.

Here is an example code snippet:

private fun requestPulsusiD() {
sendBroadcast(Intent().apply {
flags = Intent.FLAG_INCLUDE_STOPPED_PACKAGES
action = "mobi.pulsus.REQUEST_PULSUS_ID"
})
}

Did this answer your question?