Kosh
Kosh

Reputation: 6334

Strange behaviour in Android M Permissions

So I have this app that I made before the Android M came out, the app has permissions such as Camera(using custom camera within the app) Write & Read from external storage and System Alert permission I installed the app to my phone which has android 6.0 and the app was able to run normally and without any restrictions. I was able to use the camera, save files into sdcard & show a custom view using the WindowManager API.
please take a note that the target SDK for the app is android lollipop.

my question: is this even possible? the OS let apps that has target SDK smaller than M to run perfectly without asking for permissions? and if this is actually the default behaviour that android developers implement?

P.S: the identified question is not really applicable for my question. and i don't see any similarity between them at all.

Upvotes: 0

Views: 66

Answers (2)

Manuel_Rodrigues
Manuel_Rodrigues

Reputation: 560

Yes, it is possible. But that can give you a big problem. If the user deactivates some permission your app simple crushes because the permission is no longer available. The OS ask the user "This app was developed for a previous android version. disabling this permission can cause unexpected closing of the app" (ore some thing similar). In conclusion this is the normal behaviour because the android version that you are using to compile your app is before permissions needed to be confirmed by the user.

https://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en

this link explains all you need to now about your question .

Upvotes: 2

IlyaGulya
IlyaGulya

Reputation: 967

Yes, if your app has targetSdkVersion below 23, it will work on M and above without asking any permissions (they will be asked during installation).

But if user will revoke any permission himself, app will crash. It was made by Google to get backwards compatibility with old applications that does not support new Permissions API.

You can read more about it here. Here is quote from that page:

If the device is running Android 5.1 or lower, or your app's target SDK is 22 or lower: If you list a dangerous permission in your manifest, the user has to grant the permission when they install the app; if they do not grant the permission, the system does not install the app at all.

Upvotes: 2

Related Questions