Doubt about APIs and Android versions: minSdkVersion

2

Currently I develop my small applications always in "minSdkVersion 17", which I would swear is the same as the famous API.

If I use functions implemented in API 26 for example, would phones with the most outdated operating system be out of my application?

Specifically, I say this because I've been seeing that the way to launch notifications changed relatively recently, and now it's done through channels and it requires using API 26, so if I want to keep my device available for everyone And showing notifications is impossible for me?

Thank you,

Edit: build.gradle

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.exemple.notifprueba"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 3
    multiDexEnabled true
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}

The question is, if I increase the minSdkVersion, will my application stop being available for many mobile devices?

    
asked by Macia Estela 20.06.2018 в 22:41
source

1 answer

1

By defining the minSdkVersion

in your build.gradle
minSdkVersion 17

refers to the minimum API in which your application would work, this means that when you publish it in the Google Play Store it will only be available for devices with Android 4.2 or higher

  

The question is, if I increase the minSdkVersion, it will stop being   my application available for many mobile devices?

Who determines what devices with a certain minimum operating system your application will be available for is minSdkVersion

  

If I use functions implemented in API 26 for example, they would be   out of my application the phones with the operating system more   old-fashioned?

According to your configuration only it would not be available for devices with Android operating system smaller than 4.2, since you have defined

minSdkVersion 17
  

Specifically, I say it because I've been seeing that the way to launch   notifications changed relatively recently, and now it's done   through channels and it is required to use API 26, so if I want   keep my device available for everyone and show   Notifications is impossible?

Regarding the notifications, your question is interesting, I told you that the key here is with targetSdkVersion compile your application.

  
  • If you compile with targetSdkVersion 26 , you need to set channels to be able to receive notifications .

  •   
  • If you compile with targetSdkVersion 25 o menor , you do NOT need to set channels to be able to receive notifications.

  •   

You can even define targetSdkVersion 25 o menor and compileSdkVersion 26 and it is not necessary to set channels , the important thing here is the targetSdkVersion .

android {
compileSdkVersion 26
defaultConfig {
    ...
    minSdkVersion 17
    targetSdkVersion 25
    ...
    ...
}

But as a recommendation it is always better to take into account that we must update the applications, at some point you must change to a minimum targetSdk 26 , in fact the same Android Studio at some point in the future will no longer allow you to use targetSdk 25 o menor because the libraries would surely no longer support it.

    
answered by 21.06.2018 / 19:46
source