Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
242 views
in Technique[技术] by (71.8m points)

android - Why has the READ_PHONE_STATE permission been added?

In the latest beta version I just published to the Play Store, I notice that the READ_PHONE_STATE has been added since the previous version.

I haven't added this myself. All I can recall doing since the previous version is using v9.6.0 of various play-services libraries (was v9.4.0):

compile 'com.google.android.gms:play-services-location:9.6.0'
compile 'com.google.android.gms:play-services-places:9.6.0'
compile 'com.google.android.gms:play-services-auth:9.6.0'

Would this have done it? I can't see it documented. Can I get rid of the permission?

And I've ensured that all the of the libraries I'm using match the main app, as per this answer... makes no difference in my case.

EDIT

OK based on this article, I've delved into my log output to find:

ADDED from [Meteogram:jobdispatcher:unspecified] C:UsersMeAndroidStudioProjectsMeteogramappuildintermediatesexploded-aarMeteogramjobdispatcherunspecifiedAndroidManifest.xml:37:25-84 android:uses-permission#android.permission.READ_PHONE_STATE

But nothing has changed in the jobdispatcher library (which I imported into my project as a gradle module) since the last version.

EDIT2

Here is a bit more from that log, and my feeling is that maybe it is due to the play-services library version as suspected?

ADDED from [Meteogram:jobdispatcher:unspecified] C:UsersMeAndroidStudioProjectsMeteogramappuildintermediatesexploded-aarMeteogramjobdispatcherunspecifiedAndroidManifest.xml:37:17-87
    android:name
        ADDED from [Meteogram:jobdispatcher:unspecified] C:UsersMeAndroidStudioProjectsMeteogramappuildintermediatesexploded-aarMeteogramjobdispatcherunspecifiedAndroidManifest.xml:37:25-84
android:uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from C:UsersMeAndroidStudioProjectsMeteogramappsrcproAndroidManifest.xml:2:1-12:12 reason: com.google.android.gmscore.integ.client.location has a targetSdkVersion < 4
activity#com.google.android.gms.common.api.GoogleApiActivity

The targetSdkVersion < 4 matches with the other answer linked above, but is there anything I can do in this situation, since the play-services library is not mine?

EDIT3

I found an answer... rather than delete this question I'll leave it up, with solution, in case it's useful for others (and in case someone else has a better solution!)

EDIT4

Looks like it has been fixed in 9.6.1.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I eventually found this, which reports the same issue. One workaround is mentioned in Answer #3, which is to remove the permission "manually" (my assumption is that the permission is only required for very early Android versions, which is OK for me since my minSdk is 16):

<manifest ...
    xmlns:tools="http://schemas.android.com/tools"
    ... >

<uses-permission
    android:name="android.permission.READ_PHONE_STATE"
    tools:node="remove" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...