Is there any way to get around the new Android 6.0 Permissions system if you need to build your App for Android 6.0 and use it on a 6.0 Device?
I ask because there are so many Apps in the App Store which are not asking for any permissions and that's kinda weird. For me that means there are two possibilities.
They all are not compiling their apps for android 6.0
They are somehow getting around the new permissions system using android 6.0
So is there a way around?
Change your targetSDK to 22 will work on all device without permissions runtime, If your targetSDK is 23 than you have to set permission you can't overcome this.
Related
As per the android developers site, minimum sdk for Instant app is 21, ie 5.0.
link
The site clearly states : Android Instant Apps are available on the majority of devices running Android 5.0 (API level 21) and higher.
But when we create a new project as per the guideline given in this link
which states that we need to have minimum sdk of 23, to get instant app support.
And does not allow me to create a support for 5.0.
as shown in below image which I tried :
That requirement exists only in the setup wizard, and it is a bug. If you change the value to something lower after creating the project, you'll see that it builds fine and can run on API 21 and 22 devices.
The documentation is correct about supported Android versions, but note that even that doesn't dictate any particular minSdkVersion. You can build an instant app with a minSdkVersion lower than 21. It just won't run on anything before 21, since the Instant Apps Runtime itself is restricted to 21+.
For that reason, this check was always a bug, even when we didn't support devices before 23. I was told it was fixed in 3.0, though I didn't verify. I checked tonight and confirmed that the check is still present in 3.0. Could be fixed in a more recent version. But if not, we need to fix that. I'll follow up.
That requirement might be due to android run-time permission support Requesting Permissions at Run Time as official document mention
Note: Beginning with Android 6.0 (API level 23), users can revoke permissions from any app at any time, even if the app targets a lower API level. You should test your app to verify that it behaves properly when it's missing a needed permission, regardless of what API level your app targets.
Currently it has been fixed with android studio 3.1 Canary 5
For instance app minimum API 23: Android 6.0 (Marshmallow).
Please follow this link https://developer.android.com/topic/instant-apps/getting-started/first-instant-app.html
I updated xamarin android and now compile app using version 7.0(Nougat). But when I deploy app on 6.0.1(marshmallow), all permissions are already set. When I turn off location permission from settings, alert displays "this app was designed for an older version of android. denying permission may cause it to no longer function as intended". Then if we deny permission and method Context.CheckSelfPermission in the app return Permission.Granted anyway.
Is this xamarin issue or something change in SelfPermission behaviour?
Application.Context.CheckSelfPermission(Manifest.Permission.AccessCoarseLocation) == Permission.Granted//returns true, even if permission is off
Application.Context.CheckSelfPermission(Manifest.Permission.AccessFineLocation) == Permission.Granted//returns true, even if permission is off
My solution was to set the target SDK to 23 in the manifest. This way, it tells the device that you have tested for this API level, therefore the AppCompat method CheckSelfPermission will work.
I had a similar problem. What seems to have resolved my issue was changing the Project options in Xamarin. In the Android Application tab of the project options, I had "Automatic - use target framework version (API 24)" selected for Target Android version, when I changed it to "Override - Android 7.0 (API 24)" it seems to have resolved the issue.
Apparently you need to set and explicit targetSdkVersion, Automatic seems to result in < 23 behavior.
I have updated my device few days ago. Its an lollipop upgrade, but still it started asking permissions for my app at run time.
I have targetSDK 21
But when I open app it pops up for gps permission and if user denied it, it stops working.
I also used checkSelfPermission but it is retuning Granted(0) every time even user denied it.
My current android version of Phone is android 5.1.1
Device having android 5.1.1 but its OS is customised by MI like samsung phones. So after upgrade it started asking permission for resource like GPS, Contact and other. Its android sdk version is android 5.1.1 not Android 6.0 which have Runtime Permissions.
You require to implement runtime permission check for Android-21 plus device. Check the solution over here. You will find how array has been utilized in that, mostly that is were user stucks.
Additionally, if denied then you cannot force user to use that functionality. In short you need to bypass that module.
Lollipop have no runtime permission mechanism.
Runtime Premission came up with Android M.
change the sdk version under gradlebuild minSdkVersion 20 check from here https://developer.android.com/about/versions/android-5.0.html
This is an easy question and I would really be helped if somebody would confirm my idea.
There is a new feature/change in Android 6, that are the runtime permissions, where apps do not query for permissions at run time, but instead during the time they really use the featre. It's a great idea, but supporting it would require me to change code and I would rather not code more Java than absolutely necessary.
Hence, if I do not really need the features of API 23 (Android 6) features, can I simply use the API 22 version and keep my code unchanged, yet able to run on Android 6 phones?
My take is that a new Android Version is compatible with at least some previous API versions, and else all apps would need to be updated.
Hence, if I do not really need the features of API 23 (Android 6) features, can I simply use the API 22 version and keep my code unchanged, yet able to run on Android 6 phones?
TL;DR: you do not need to deal with runtime permissions, but not for the reasons that you cite.
What controls whether your app has to deal with runtime permissions is your targetSdkVersion. If that is 23 or higher, you have to handle runtime permissions in your Java code. If that is 22 or lower, you do not, though the user can still revoke permissions through Settings.
targetSdkVersion affects some, but not all, features of an API level. Usually, the things that it affects are written up in the JavaDocs for the Build.VERSION_CODES value, but for whatever reason, Google decided not to bother.
Whether you can code to any API Level 23 features is tied to your compileSdkVersion. There are many things in an API level that are not affected by targetSdkVersion, such as new classes and new methods. In your case, you indicate that you do not need any of this, which is fine. However, compileSdkVersion does not affect whether Android 6.0+ requires you to implement runtime permission logic in the Java code; targetSdkVersion does.
Eventually, something is going to force your hand to raise your targetSdkVersion to 23 or higher. At that point, you will need to "bite the bullet" and deal with the runtime permissions.
If you compile your app at API 22, you won't be able to use any feature of API 23. And your app will behave normally on API 23 as it does on API 22.
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.
Requesting Permissions at Run Time
I have built an app with android sdk version 22 and now I want to upgrade it with sdk 23. I know that from Android 6.0 onwards user would have to allow or deny dangerous permissions at runtime. But in my case when I compiled my app with sdk 23 and run it on a Android Android 6.0 device(I tried with two devices) I can see the app is not crashing and all the dangerous permissions which are enlisted in Manifest are given by default. Can someone please help me finding out why this is happening?
Have you changed TargetSDK to 23?
Android checks the target sdk and loads apis of that target. Here even though you are compiling it to 23, android thinks that Marshmallow apis are not used and hence defaults to previous API. So run time permissions are not checked.