We have a custom DPC that has device owner rights and the READ_PRIVILEGED_PHONE_STATE permission but if we build it with the Android 15 SDK, we can no longer get the device serial number. This is happening on numerous devices. We always get a security exception which we can then catch and get the device enrollment identifier.
We are just calling the Build.getSerial(); - after checking the version and the enrollment type.
The same code was getting the serial number when built with the Android 14 sdk.
The Android 15 documentation states that we should still be able get the serial number if we have device owner rights and the READ_PRIVILEGED_PHONE_STATE permission but this doesn't seem to be the case. Is the documentation wrong and is this a change for Android 15, is this an Android 15 bug or is there a new way of getting the serial number?
Our customers would expect to get the serial number for identification purposes.
We have a custom DPC that has device owner rights and the READ_PRIVILEGED_PHONE_STATE permission but if we build it with the Android 15 SDK, we can no longer get the device serial number. This is happening on numerous devices. We always get a security exception which we can then catch and get the device enrollment identifier.
We are just calling the Build.getSerial(); - after checking the version and the enrollment type.
The same code was getting the serial number when built with the Android 14 sdk.
The Android 15 documentation states that we should still be able get the serial number if we have device owner rights and the READ_PRIVILEGED_PHONE_STATE permission but this doesn't seem to be the case. Is the documentation wrong and is this a change for Android 15, is this an Android 15 bug or is there a new way of getting the serial number?
Our customers would expect to get the serial number for identification purposes.
Share Improve this question asked Feb 4 at 10:48 NoScoobyNoScooby 314 bronze badges1 Answer
Reset to default 1This was just a permissions thing. I really should have spotted it earlier. The READ_PHONE_STATE is the one. I had removed that by mistake. Restoring it has fixed the issue.