Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-91 android: Implement the changes in getting serial (Api_level 26): #126

Closed
wants to merge 1 commit into from

Conversation

selmo47
Copy link

@selmo47 selmo47 commented Jul 16, 2020

* get the serial according to the Api_level:
    + if Api_level < 26:
      => android.os.Build.SERIAL (deprecated in Api_level 26)
    + else:
      => serial = android.os.Build.getSerial(); (introduced in 26)
* add the appropriate permissions:
    + READ_PHONE_STATE
    + READ_PRIVILEGED_PHONE_STATE

Platforms affected

  • Android (only)

Motivation and Context

The android 9 introduced some changes in reading crucial device info (https://developer.android.com/about/versions/pie/android-9.0-changes-28), so to get the serial number of a device, you must use getSeial method instead of the 'SERIAL' constante (whoch is depricated), you need also the following permissions
* READ_PHONE_STATE
* READ_PRIVILEGED_PHONE_STATE

Description

Testing

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

…el 26):

    * get the serial according to the Api_level:
        + if Api_level < 26:
          => android.os.Build.SERIAL (deprecated in Api_level 26)
        + else:
          => serial = android.os.Build.getSerial(); (introduced in 26)
    * add the appropriate permissions:
        + READ_PHONE_STATE
        + READ_PRIVILEGED_PHONE_STATE
Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if READ_PHONE_STATE permission is sufficient but we cannot accept a PR that adds privileged permissions. See this notice

Caution: Third-party apps installed from the Google Play Store cannot declare privileged permissions.

Therefore READ_PRIVILEGED_PHONE_STATE cannot be used.

<param name="android-package" value="org.apache.cordova.device.Device"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cordova cannot define privileged permissions because that would cause apps to be rejected from the Google Play store.

@SebLevDev
Copy link

Up ?

@breautek
Copy link
Contributor

Closing this PR because obtaining the Serial / uuid (as well as any other non-resettable identifier) is no longer possible without privileged permissions.

#111 (comment)

@breautek breautek closed this Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants