0

I am wondering if there is a way to remove some permission added in manifest file from gradle file, when building project.

Example: I have a permission in manifest.xml.

<uses-permission android:name="android.permission.SEND_SMS"/>

Now, I want to achieve, if user has a device above 29, do not ask for that specific permission, else ask for it. I can not find any documents(if that is even possible).

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
DM developing
  • 423
  • 5
  • 15

1 Answers1

0

You can try with

if (android.os.Build.VERSION.SDK_INT > 29) {
    // ask permission programmatically, see https://stackoverflow.com/questions/40798731/how-to-give-run-time-permission-for-marshmallow-for-read-sms-from-inbox-in-eclip
} else {
    // whatever
}

If you're under android Donut you have to use a different class. See here.

Fede
  • 321
  • 1
  • 9