Skip to content Skip to sidebar Skip to footer

Android O Device Serial Number From Native

What is the proper way to get the serial number from native on Android O without calling the Java Build.getSerial(). On Android < 26 versions from native we could get the device

Solution 1:

You can use Build.getSerial() to get the serial number.

If the user has granted the READ_PHONE_STATE permission then there is no problem but if the user revoked the permission or has never granted it - you should take into consideration that you will get a SecurityException at runtime when trying to retrieve it.

In general - it looks like Google is slowly pushing to prevent apps from using personal identifiable information (like serial numbers of device) over the last few years so and you should look into alternatives like installationId.

Post a Comment for "Android O Device Serial Number From Native"