Understanding Android 6.0 with targetSDK=22 behaviour - android

I have app (current targetsdkversion is 23) running in version 4.4 & 5.1 but with 6.0 It requires run time permssion.
This needs some coding changes I prefer to defer for sometime. Is it perfectly okay change the targetsdkversion to 22 instead of 23. Does this allow app to be run in 6.0 without using 'run-time permission'? I read app mayn't properly if user decides to change the permission after installation. Im okay with this limitation for now.

Be careful if you have already published the app with targetSdkVersion of 23, those users who have installed it will not be able to "upgrade" to a new version of your app because of the target SDK downgrade. They'll have to uninstall then re-install your app.
But, to answer your question about API levels, yes it will run fine on Marshmallow with target SDK set to 22. The users will be presented with an old style permission accept dialog when installing the app and all permissions will be granted at install time. However, users could go in a disable the permissions via Settings so your app could start receiving SecurityException for protected operations.

Related

Android Update app with all resource without ask All vs New

I have created Android app a while ago.
this app use inside the company. we not uploaded to Google play store. Just install APK.
and now I updated the app with the new resource. while update app install screen ask from users to New or All
see the photo
I want to skip or hide this screen
just install all data without ask.
how can I do this?
thank you
It is the old permissions screen.
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.
You can't skip it.
Instead if the device is running Android 6.0 or higher, and your app's target SDK is 23 or higher you can use the runtime permissions.
Check here for more details.

Android M "Runtime Permissions" not requested at runtime?

I was getting ready for runtime permissions on android M when I recently figured out that (at least on theGgalaxy S6 of my friend), still all permissions have to be confirmed at installation time (Google Play).
He has Android M, and sure you can revoke the permissions in the app settings now, but initially when you start the app after install, everything is granted.
I am kind of surprised, that's not the "Runtime Permissions" I was expecting.
Any hints on that? Did I miss something?
According to the doc:
This lesson describes how you implement permissions requests on apps that target API level 23 or higher, and are running on a device that's running Android 6.0 (API level 23) or higher. If the device or the app's targetSdkVersion is 22 or lower, the
system prompts the user to grant all dangerous permissions when they
install or update the app.
The runtime permissions will only take effect if you update the target SDK to 23

Any way to avoid Install Failed Permission level downgrade on Android?

I'm getting an error - INSTALL_FAILED_PERMISSION_LEVEL_DOWNGRADE while installing app from adb after targeting sdk 22, coming down from 23.
I have to do this, temporarily because of some other issues but it would not be the best experience for the users updating the app on Google play if they just couldn't. The only solution I know as of now is to uninstall the current version (targeting SDK 23) and then install the update (targeting SDK 22).
Even though there are only a handful of people on Marshmallow right now, it would be best if they don't face this issue.
Does anyone know anything about this?
Update: AFAIK nothing can be done in the app or on the console to avoid users uninstalling and installing the app. Luckily, I did it when the users on Marshmallow were few.
Perhaps this answer does not directly address the question, but may it helps others to achieve a faster solution.
I have created some versions with the following configuration (inside build.gradle) and made them available to alpha- and beta-tester via Google Play Console:
minSdkVersion 23
targetSdkVersion 23
When I noticed that users with a deeper system-version could not install the app, I changed the configuration as follows:
minSdkVersion 19
targetSdkVersion 19
However, this resulted in the downgrade error message in Google Play Console. So I adapted the configuration that the new version for both
user with a lower system version as well as for users who have installed the current app (with a higher system version).
minSdkVersion 19
targetSdkVersion 23

Marshmallow Permissions not working for TargetVersion below 23

My project is a long running project. I had set the target version as 10, 4 years back. I cant change the target version to 23, since I am using httpImageCache and also having issues with UI's. My problem is, when Marshmallow released I tried to integrate Marshmallow with targetVersion 10,
int returnedPermission = ContextCompat.checkSelfPermission(MyActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
this function is always returing '0' if I manually ON or Off storage permission from App Settings page. Can any one please help me?
As #Commonware has already given the answer, but here I am adding more detail to the question which might help you.
As per the official android developer site:
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.
If the device is running Android 6.0 or higher, and your app's target
SDK is 23 or higher: The app has to list the permissions in the
manifest, and it must request each dangerous permission it needs
while the app is running. The user can grant or deny each permission,
and the app can continue to run with limited capabilities even if the
user denies a permission request.
As your target SDK is 10, application will run perfectly like previous. Anyway please note that user still can revoke a permission after that..!!! Although Android 6.0 warn the user when they try to do that but they can revoke anyway.
Above statement is taken from official android developer site.
Can any one please help me?
Delete that code, as it is useless for you. If your targetSdkVersion is below 23, you cannot find out whether or not the user revoked permissions.
use PermissionChecker.checkSelfPermission()
when targetSdkVersion <= 22,you also can use requestPermission()

How can I ensure my app can not be installed on Marshmallow

In android gradle build file I have the following closure:
android {
compileSdkVersion 21
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.mycoolapp"
minSdkVersion 16
targetSdkVersion 21
versionCode 41
versionName "3.0"
}
}
I do not want my app to run on Marshmallow. My targetSdkVersion is 21 and Marmallow would be 23. So imagine I have a phone that is Marshmallow, if I go to the play store will my app appear in the listing?
My second question is how would I stop my app from appearing in google play store for marshmallow devices?
So imagine i have a phone that is Marshmallow, if i go to the play store will my app appear in the listing ?
Yes.
how would i stop my app from appearing in google play store for marshmallow devices?
You are welcome to try android:maxSdkVersion in the <uses-sdk> element of your manifest, as the current documentation suggests that the Play Store uses it as a filter, though this comes at a cost to users who get upgrades of their app to Android 6.0.
Answering not to original question, but to reasons of it.
I'm not sure you have to do it.
api 23 is asking for runtime permissions. so if i have a device running 23 and since android is backward compatible, what will happen for example if im using apache httpClient which is depreacated in marshmallow
You still can use HTTP client. From the docs:
To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:
android {
useLibrary 'org.apache.http.legacy'
}
I tried to install my old applications which use HTTP Client on Android 6.0. They still work, without the dependency in build.gradle and even without recompiling.
or if im not prepared to handle runtime permissions ? wont my app break in this case ?
App wouldn't break. If you don't compile your app under Marshmallow (targetSdkVersion 23 or higher) then it will work in "legacy" mode: permissions will be requested before installation. With one exception: users still can switch off permissions in settings; I don't think that many users do it.
Try your app in emulator or real device. I'm almost sure it will work under Marshmallow.
may be i think it is described in app runtime permission model will work if we target api to 23
Note: This lesson describes how you implement permissions requests on apps that target API level 23 or higher, and are running on a device that's running Android 6.0 (API level 23) or higher. If the device or the app's targetSdkVersion is 22 or lower, the system prompts the user to grant all dangerous permissions when they install or update the app.
link: https://developer.android.com/intl/es/training/permissions/requesting.html
may be if i have some misunderstanding then please notify me

Categories

Resources