You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/03/08 12:36:08 UTC

[GitHub] [cordova-plugin-device] breautek commented on issue #91: device.serial returns wrong data in samsung devices

breautek commented on issue #91:
URL: https://github.com/apache/cordova-plugin-device/issues/91#issuecomment-792727277


   > So how i can get the serial number?
   
   In API 28+ you need to qualify in these conditions:
   
   https://developer.android.com/reference/android/os/Build#getSerial()
   
   * If the calling app has been granted the `READ_PRIVILEGED_PHONE_STATE` permission; this is a privileged permission that can only be granted to apps preloaded on the device.
   * If the calling app is the device or profile owner and has been granted the `READ_PHONE_STATE` permission. The profile owner is an app that owns a managed profile on the device; for more details see [Work profiles](https://developer.android.com/work/managed-profiles). Profile owner access is deprecated and will be removed in a future release.
   * If the calling app has carrier privileges on any active subscription.
   * If the calling app is the default SMS role holder
   
   In other words, unless if you're a very special app, you cannot read the serial number anymore.
   
   As of API 26, the native `serial` property will always be `unknown`.
   
   On API 28 or lower, the native `getSerial` method will be `unknown` unless if your app matches one of the conditions above.
   On API 29 or later, the native `getSerial` method will throw an exception unless if your app matches one of the conditions above.
   
   I advise reading Google's [recommendations](https://developer.android.com/training/articles/user-data-ids) for what to use instead.
   
   Closing this as won't fix.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org