question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PhoneStateReadTest need to be compatible with Android Q

See original GitHub issue

https://developer.android.com/preview/privacy/data-identifiers#device-ids

从 Android Q 开始,应用必须具有 READ_PRIVILEGED_PHONE_STATE 签名权限才能访问设备的不可重置标识符(包含 IMEI 和序列号)。许多用例不需要不可重置的设备标识符。如果您的应用没有该权限,但您仍尝试查询标识符的相关信息。会返回空值或报错。

class PhoneStateReadTest implements PermissionTest {


    private Context mContext;

    PhoneStateReadTest(Context context) {
        this.mContext = context;
    }

    @Override
    public boolean test() throws Throwable {
        PackageManager packageManager = mContext.getPackageManager();
        if (!packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) return true;

        TelephonyManager telephonyManager = (TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
        return telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE ||
            !TextUtils.isEmpty(telephonyManager.getDeviceId()) ||
            !TextUtils.isEmpty(telephonyManager.getSubscriberId());
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
yanzhenjiecommented, Jul 6, 2019

It’s just a new feature, but currently only supports AndroidP, AndroidQ is still in beta, I will follow up on this issue later.

0reactions
yanzhenjiecommented, Sep 30, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Device compatibility overview - Android Developers
As an app developer, you don't need to worry about whether a device is Android compatible, because only devices that are Android compatible...
Read more >
Sharing what's new in Android Q
With Android Q, we'll update important OS components in the background, similar to the way we update apps.
Read more >
All you need to know about the latest Android Q - Peerbits
After a long wait, Android has finally came up with its latest version Android Q. This time they introduced their new update with...
Read more >
Android Q: everything you need to know about Google's update
Google has released the third public beta of Android Q this week, so if you have a ... so be warned: not everything...
Read more >
Intune Support for Android Q | Android 10
Both our Intune App Protection Policy (APP or MAM) team and our Mobile Device Management (MDM) team have been testing each beta release...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found