Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NewPosAndroidVersionAdapter

This repository provides the behavior changes and new features of different major versions of Android and highlights the points to note on POS devices.

Android POS version adaptation complete guide

This open source public repository is maintained by NEWPOS internal professional developers in line with Google's Android updates. It aims to provide customers with compatibility summary and template code for different major Android versions, and to improve NEWPOS customers' development efficiency and code quality on NEWPOS Android POS devices.

The documents we provide are for reference only.

Android 13 changes compiled by NEWPOS developers

Android 12 changes compiled by NEWPOS developers

Adaptation process

  • Here we take the adaptation of Android 13 as an example. The first step is to modify the values of targetSdk and compileSdk in the build.gradle file in the main module.

New version gradle configuration, gradle or gradle.kts

android {

    compileSdk 33
    defaultConfig {
        //......
        targetSdk 33
    }
}

Old version gradle configuration

android {

    compileSdkVersion 33
    defaultConfig {
        ......
        targetSdkVersion 33
    }
}
  • Next, make some version judgments in the code and make sure the new version is compatible with the old version.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
    ......
} else {
    ......
}
if (context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.TIRAMISU) {
    ......
} else {
    ......
}

compileSdk & targetSdk

  • The following briefly introduces the meaning of compileSdk and targetSdk, Just for our understanding.

    • targetSdk:The target adaptation version tells the system how the app is adapted. If the targetSdk of the app is lower than the system version, the new system will make some new features backward compatible. If we want to adapt to a certain Android version, we must adjust the targetSdk to this version level, otherwise some adaptation anomalies may occur on some models. If we simply increase the targetSdk level without adapting to the features of the new version, the app may have functional anomalies on the new system, which is generally manifested as app crashes or failure to obtain data.

    • compileSdk:Compile source code version. We can change the version of the Android SDK source code we see in the code by modifying this version level. It also determines the version used by the compiler when checking the code.

Android Developers Official Website Address

License

See the Apache 2.0 license file for details.

Copyright 2025 NEWPOSTech CO., LTD ("NEWPOS")

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at following link.

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

This repository provides the behavior changes and new features of different major versions of Android and highlights the points to note on POS devices.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors