-1

I am developing an app and the manifest has included permissions INTERNET and SEND_SMS. There was no asking of permissions when the apk was installed by Android Studio to either an emulator or a real phone.

When I ran the app, which sends an SMS, there was a permission exception. I had to go to Settings, Apps and under Permissions, there is an option to enable SMS. After I enabled it, the app could send SMS'es.

When the app made a network call using HttpUrlConnection, it completed successfully! Under Settings Apps, there is no option for network or Internet or the like.

Why is it that making a network communication does not require any permission by the user?

Under Settings, Apps, why is there only one permission, SMS, listed for my app?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Old Geezer
  • 14,854
  • 31
  • 111
  • 198
  • 1
    You should provide `Runtime Permission` for Android OS version 6.0(Marshmallow) and above. – vss Aug 30 '17 at 05:00
  • for *SEND_SMS* you need to user security permissions check from here. Same https://stackoverflow.com/questions/35973235/android-permission-denial-starting-intent-with-revoked-permission-android-perm/35973323#35973323 – Saveen Aug 30 '17 at 05:00
  • post your gradle and manifest file – Rajesh Aug 30 '17 at 05:01

3 Answers3

0

It's the developer responsibility to request the permission at the runtime. Before accessing any danger permission. (Runtime Permission are supported from Android M(6.0))

Not all the permission need to be requested from the user. Only Danger Permission needs an approval from the user. Normal and Danger Permsission

Please follow this guide Runtime Permission

VinayagaSundar
  • 1,673
  • 17
  • 18
  • My question was not about permissions asked/given at install time or run time. My question was that no permissions was ever given at all for Internet access. And for SMS, the permission was never asked at all. I had to figure out that there was a permission exception and went to Settings to grant the SMS permission. – Old Geezer Aug 30 '17 at 05:05
  • @OldGeezer Please check Normal And Danger Permission link in the above answer. – VinayagaSundar Aug 30 '17 at 05:07
  • I see. So INTERNET is Normal and always granted. But I didn't get a dialog box to ask for SMS as described for Dangerous permissions. – Old Geezer Aug 30 '17 at 05:14
  • As I told you it's developer responsibility to request permission. if he/she doesn't handle it in the code it won't show the dialog when you're running the app. that case you need to manual enable permission from Settings – VinayagaSundar Aug 30 '17 at 05:17
  • I see. So it's not the runtime eco-system that automatically asks for the permission when a permission listed in the manifest is used, but it's a manual request initiated in code. – Old Geezer Aug 30 '17 at 05:40
0

The permissions model was changed in Android 6.0. If the app targets API 23 or above than you need to request the user for the permissions in runtime. If the app targets below API 23 than the app gets the permissions during intall.

There are some permissions like "INTERNET" that will always be during intall.

Raz
  • 8,918
  • 3
  • 27
  • 40
0

You're running your app in Android SDK>=23.

Internet permission is under Normal permission so it does not show any permission prompt but Camera permission is under Dangerous Permission so it shows permission prompt.

If an app declares that it needs a normal permission, the system automatically grants that respective permission to the app.

Refer:
Reference - Android Permissions

StackOverflow

Permission Requests

Lalit Fauzdar
  • 5,953
  • 2
  • 26
  • 50
Ashish John
  • 1,867
  • 2
  • 23
  • 38