1

In my app, I'm checking the Build.VERSION.SDK_INT in order to conditionally warn users that they need to update Android in order to use a particular feature. It looks something like this:

if (Build.VERSION.SDK_INT >= 15) {
    // Good to go
} else {
    // Needs an Android update
}

In the latest update I released, the READ_PHONE_STATE permission has been added, even though it is not declared in AndroidManifest.xml which looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.me.myapp"
    android:versionCode="1"
    android:versionName="1.0.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="14" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.android.vending.BILLING" />
    ...

I've found a couple of related questions (1, 2), and I'll try to test later if my dependencies are causing the issue.

But just out of curiosity (and since I can't access my code right now), will using Build.VERSION.SDK_INT cause the READ_PHONE_STATE permission to be added automatically?

Or better yet, what might cause this permission to automatically be added?

Community
  • 1
  • 1
Chris Cirefice
  • 5,475
  • 7
  • 45
  • 75
  • 1
    Adding a piece of java code to your app will never cause permissions to be added. The answer to the first StackOverflow question you referenced seems to cover the possible causes well. – NasaGeek Sep 27 '15 at 20:05
  • @NasaGeek that's kinda what I thought... I suppose that I'll have to wait until I get home to figure out my dependencies and their permissions. – Chris Cirefice Sep 27 '15 at 20:13
  • People can't just update their Android Version. Instead of telling the user to update, just make that feature unavailable. – Eugene H Sep 27 '15 at 20:16

1 Answers1

1

will using Build.VERSION.SDK_INT cause the READ_PHONE_STATE permission to be added automatically?

No.

Or better yet, what might cause this permission to automatically be added?

A library, most likely.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491