Starting with Android 10 (API level 29), programmatic access to information such as IMEI, MEID, and the device’s serial number has been heavily restricted. This has impacted many apps that rely on these data, preventing direct retrieval of this information.
To work around this limitation, Urmobo MDM has implemented a solution that allows clients to continue accessing these identifiers through our app, in a secure manner and compliant with the new Android policies.
📲 How to Request Data from Urmobo MDM
The process begins by sending an Intent to Urmobo requesting the device data. Below is an example implementation:
Intent request = new Intent("com.urmobo.mdm.GET_DEVICE_DATA");
request.setPackage("com.urmobo.mdm");
// Creates the PendingIntent for the response
Intent replyIntent = new Intent(this, UrmoboReplyReceiver.class);
replyIntent.setAction("com.cliente.RESPONSE_INFO");
PendingIntent replyPending = PendingIntent.getBroadcast(
context, 0, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE
);
// Attaches the PendingIntent to the original intent
request.putExtra("UrmoboReply", replyPending);
// Sends the broadcast
context.sendBroadcast(request);📥 How to Receive the Response
You must create the UrmoboReplyReceiver class that will receive the Intent with the responses. When Urmobo MDM processes the request, it returns the data to the requesting app via broadcast to this class, which should inherit from BroadcastReceiver, similar to the example below:
public class UrmoboReplyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String id = intent.getStringExtra("UrmoboID");
String imei = intent.getStringExtra("IMEI");
String serial = intent.getStringExtra("SerialNumber");
String token = intent.getStringExtra("EntityToken");
}
};Don't forget to add this class to the AndroidManifest as well, as shown in the example below:
<receiver android:name=".UrmoboReplyReceiver" android:exported="true" />🔁 Customizing the Action
The value "com.cliente.RESPONSE_INFO" used in the Intent and IntentFilter can (and should) be adjusted according to your app’s package name or the action you want to define. This ensures that the receiver listens only to the broadcasts intended for your application.
With this mechanism, it is possible to securely retrieve the following data:
- UrmoboID (unique identifier generated by Urmobo)
- IMEI(s) (if there is more than one, they will be separated by semicolons ";")
- Device serial number
- Device entity token
This approach ensures compatibility with the new Android requirements without sacrificing critical information for device management. ✅