I cant get serial on android 10 device.
I know about everything(permission, runtime permissions, I get serial only after the permission is granted) from here android Build.GetSerial() throwing exception
My code works on all android versions, except 10
Do you have any ideas?
android.os.Build.FINGERPRINT: A string that uniquely identifies this build. It SHOULD be reasonably human-readable. It MUST follow this template: $(BRAND)/$(PRODUCT)/$(DEVICE)/$(BOARD):$(VERSION.RELEASE)/$(ID)/$(VERSION.INCREMENTAL):$(TYPE)/$(TAGS)
The Android build system compiles app resources and source code, and packages them into APKs or Android App Bundles that you can test, deploy, sign, and distribute.
In the device's system settings: Settings->System->About Tablet->Model->Serial number.
A build is a software version for a specific device - hence a build number is of course not unique. All devices with the same software version will have the same build id.
If you follow the official documentation here: https://developer.android.com/reference/android/os/Build.html#getSerial(), more info on Android 10 changes here
You will notice that starting from Android 10 this method is returning Build.UNKNOWN. You can't use it to uniquely identify a single device anymore
You need to switch to the "less" persistent version called Settings.Secure.ANDROID_ID
The only ways to bypass this restriction are:
- Create a system app to be able to get the
READ_PRIVILEGED_PHONE_STATE
system permission (a normal app can't get this).- Be registered as a carrier (which requires you to have built the Android ROM)
- Have a custom "work profile" to set your own policies in the device.
As you can imagine, all those options are not meant to be used by standard android app developers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With