java - Android O device serial number from native -


what proper way serial number native on android o without calling java build.getserial().

on android < 26 versions native device serial number using following code:

string serial = read_property("ro.boot.serialno");  ...  string read_property(const string& property_name) {   char propertyvalue[prop_value_max];   int propertylen = __system_property_get(property_name.c_str(), propertyvalue);   ... } 

on android o throws error:

access denied finding property "ro.boot.serialno" 

although read_phone_state permission granted. seems related deprecated build.serial in android 26.

i managed property using adb, value not removed , there:

adb shell getprop ro.boot.serialno 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -