All Products
Search
Document Center

Adapt to targetsdkversion 29

Last Updated: Mar 10, 2021

Background

The mPaaS standard baseline only supports up to 26 for targetSdkVersion. If your app needs to upgrade targetSdkVersion to 29, use custom baseline 10.1.68a and update the SDK and add configuration according to the following description and return to the relevant function.

Note: Baseline 10.1.68a has been tested but is still in beta phase, so please use with caution.

Update SDK

Update the SDK and related configuration with reference to mPaaS supports for multi-CPU architecture.

Adapt targetSdkVersion 29

Prerequisites

Adapt targetSdkVersion 28 with reference to Adaptation of targetSdkVersion 28 to mPaaS

Modify targetSdkVersion

Inside/AAR

Modify the attribute targetSdkVersion 29 in the build.gradle file under the main module of the project.

Portal&Bundle

  • Modify the attribute targetSdkVersion 29 in the build.gradle file under the main module of the Portal project.
  • The targetSdkVersion in the Bundle project may be left unchanged, but may not be later than that of the Portal project.

Universal configurations

Modify the project AndroidManifest.xml and add the following attributes under the application node:

 
  1. <application
  2. android:requestLegacyExternalStorage="true"
  3. ... >

The backend uses location function

If your app needs to use the location function while in the backend, you need to add and request the following permissions:

  • Add the following permissions to AndroidManifest.xml:
       
    1. <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
  • Ensure that the permission is dynamically requested before calling the locator API:
       
    1. String[] permissions;
    2. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
    3. permissions = new String[]{
    4. Manifest.permission.ACCESS_FINE_LOCATION,
    5. Manifest.permission.ACCESS_COARSE_LOCATION,
    6. Manifest.permission.ACCESS_BACKGROUND_LOCATION
    7. };
    8. } else {
    9. permissions = new String[]{
    10. Manifest.permission.ACCESS_FINE_LOCATION,
    11. Manifest.permission.ACCESS_COARSE_LOCATION
    12. };
    13. }
    14. ActivityCompat.requestPermissions(this, permissions, 101);

    Use the Bluetooth function of the mini program

If your app needs to use Bluetooth-related APIs in the mini program, you need to add and request the following permissions.

  • Add the following permissions to AndroidManifest.xml:
       
    1. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  • Ensure that the permission is dynamically requested before calling the Bluetooth API:
       
    1. String[] permissions = new String[]{
    2. Manifest.permission.ACCESS_FINE_LOCATION,
    3. };
    4. ActivityCompat.requestPermissions(this, permissions, 101);

    Regression test

Android 10.0+ devices must be included in the full regression test.

For regression test, you need to focus on the following component functions, if used:

Components Validation project
Unified data storage - Whether [Database encrypted storage] (84878) functions well.
Hotfix
- Whether [Hotfix] (49803) is in effect.
Mobile Analytics Service
- Whether the lag monitoring of [Mobile Analytics Service] (110559) functions well.
Mini programs - Whether [Mini program file API] (67569) functions well.
- Whether [Mini program Bluetooth API] (118287) functions well.
- Whether the map component of the mini program functions well.
Locating
- Whether [Locating] (53440) functions well.