Is it possible to target API30 while at the same time disallowing access to my app from Android 11+ devices. The Google Console forced an API30 targeting standard on updates and I do not want Android 11+ devices to have access to my app yet.
Thanks.
You can use maxSdkVersion.
The element is ignored by the android OS itself but apparently the Google Play Store still uses it to filter devices for apps:
Future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation. Google Play will continue to use the attribute as a filter, however, when presenting users with applications available for download.
Source: https://developer.android.com/guide/topics/manifest/uses-sdk-element
You can add it in your app module's build.gradle file:
android {
compileSdkVersion 30
defaultConfig {
...
maxSdkVersion 29
targetSdkVersion 30
...
}
}
Related
If my App has minSDKVersion = 16 and TargetSDKVersion = 28, then will Google somehow upgrade my App to work with devices which use sdk version greater than 28?
And if the same is true for all future versions of SDK then if I dont update my app meanwhile?
Please excuse me as my English is not good. Thanks.
Google never ever updates your apps for the latest SDK, you have to do it yourself and publish again. I know its a pain when google play console frequently changes requirements to support certain Target API Level but its the pain you have to endure. TargetSDKVersion is the last SDK / API which your app will support.
No, you will need to do an update by changing your targetSDK from your build.gradle file, then make the required changes in your code to work with that API level and you can upload an update.
The Playstore will not update it automatically, that's why it's called targetSDKVersion, it will just be available from SDK 16 until the target one, 28.
I have an app available for android on google play
I'm willing to make it runnable for api level >= 15
One of the apis I use in my app is crashing on api level < 20, so in order to make it run fine i need to import a third API (only for those versions, it looks like android has included the required components in newer versions)
How can a build an apk and tell google play to use this apk (larger since it includes more apis) only for api level < 20 and still use the other one for the newer version?
If I get it right you need multiple APKs for different API levels
This is the relevant Google documentation for that https://developer.android.com/training/multiple-apks/api
This done with the use of minSdkVersion and maxSdkVersion
ie.
- "older support" you can use minSdkVersion = 15 and maxSdkVersion = 19
- for newer APIs minSdkVersion = 20 without defining any max version.
Then you have to use different Version code in these apps with a sophistigated pattern for application versioning:
Check here the Using a version code scheme
eg.
This is a beginner question, but what are the steps needed to get my app to run on more devices? I noticed that my new update (on beta) is running on fewer devices. Do I just need to update the targetminsdk version in build gradle or is there anything else I need to do? I think I should be aiming for minsdkversion 18?
My versions in gradle are here
compileSdkVersion 23
minSdkVersion 21
targetSdkVersion 22
Min sdk version : Is the earliest release of the Android SDK that your application can run on. So this is what you want to change if you want more devices supported for your app.
Target sdk version : The version your application was targeted to run on. Ideally this is because of some sort of optimal run conditions.
Android Developers forum says :
The dashboard for Platform Versions is updated regularly to show the distribution of active devices running each version of Android, based
on the number of devices that visit the Google Play Store. Generally,
it’s a good practice to support about 90% of the active devices, while
targeting your app to the latest version.
For more details, go through : Supporting Different Platform Versions
For API 18 : your app will run on approximately 76.9% of the devices that are active on Google Play Store.
For API 21 : your app will run on approximately 40.5% of the devices that are active on Google Play Store.
Now that is a huge difference, that you may not really want for your app. So you need to weigh your pros and cons of having Latest API support to getting more users. I would infact recommend you to go for API 18 instead of 21, unless you have some very important functionality that necessitates API 21 and above and can't be done without.
I've faced the problem uploading app to Play Store. The old "19" version was available for API versions 10 and above. New "20" version specified maxSDKVersion=22 (not higher Android 5.1).
An error message, when trying to upload "20", says:
"it is forbidden that a device upgrading from API levels in the range
10-22 to API levels in the range of 23+ should downgrade from version
20 to version 19, which could happen if...".
This situation clearly specified in documentation:
...future versions of Android (beyond Android 2.0.1) will no longer
check or enforce the maxSdkVersion attribute during installation or
re-validation. Google play will continue to use the attribute as a
filter, however, presenting users with applications available for
download.
Our application not working properly on Android 6, so we should somehow to prevent installs on those devices.
So, there is an answer from Google support:
...
The error message is stating that if a user updates the Android
version on their device, the configuration of your APKs would cause
them to become ineligible for the version they currently have.
To resolve this issue, always make sure the APK that supports the
higher API level always has a higher version code. For example, if an
APK with API levels 14 - 17 was version 3 then an APK with API level
18 would have to have version 4.
In other cases, you can simply remove the max SDK declaration from
your app’s manifest.
...
And there is no way to add maxSDKVersion limitation in existing app.
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