Adapt mPaaS to targetSdkVersion 33

更新时间:
复制 MD 格式

Learn how to adapt your application to targetSdkVersion 33 when using mPaaS 10.2.3.35 or later, including permission changes introduced in Android 13.

mPaaS supports targetSdkVersion 33 starting from version 10.2.3.35. To upgrade your application to targetSdkVersion 33, use the mPaaS plug-in to update the SDK to 10.2.3.35 or later, and then follow the adaptation steps below.

Adapt to targetSdkVersion 33

Prerequisites

Before you begin, make sure your application has completed the adaptation for earlier targetSdkVersion levels:

Modify targetSdkVersion

AAR integration mode

Set targetSdkVersion to 33 in the build.gradle file of the main module.

Portal&Bundle integration method

Set targetSdkVersion to 33 in the build.gradle file of the Portal project's main module.

You do not need to modify the targetSdkVersion in the Bundle project, but it must not be higher than the value in the Portal project.

Notification runtime permission

Android 13 introduces the POST_NOTIFICATIONS permission:

  • For applications with targetSdkVersion < 33, the system automatically prompts the user to grant this permission when the application creates its first notification channel;

  • For applications with targetSdkVersion ≥ 33, the application can request this permission at any time;

For more information, see Notification runtime permissions.

Message Push Service

If you use Message Push Service to push messages through a self-built channel and display them in the notification bar, add this permission to AndroidManifest.xml:

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

You must also dynamically request this permission at an appropriate time. If you do not request this permission or the user denies it, messages received through the self-built channel cannot be displayed in the notification bar, regardless of whether you customize message processing.

Fine-grained media permissions

Starting from Android 13, the READ_EXTERNAL_STORAGE permission no longer takes effect. It is replaced by the following three fine-grained permissions:

  • READ_MEDIA_IMAGES

  • READ_MEDIA_VIDEO

  • READ_MEDIA_AUDIO

For applications with targetSdkVersion ≥ 33:

  • Dynamically requesting READ_EXTERNAL_STORAGE no longer triggers a permission dialog;

  • Calling checkSelfPermission for READ_EXTERNAL_STORAGE on a fresh install always returns false;

  • If an application with targetSdkVersion < 33 was previously granted READ_EXTERNAL_STORAGE, upgrading it to targetSdkVersion ≥ 33 through an override installation automatically grants all three new permissions;

Add one or more of the following permissions to AndroidManifest.xml based on your business requirements:

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>

Then update the code logic that dynamically requests or checks READ_EXTERNAL_STORAGE to use one or more of these three permissions instead.

Mini program multimedia

To use the mini program multimedia API, add this permission to AndroidManifest.xml.

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>

You must also dynamically request this permission at an appropriate time. If the permission is not granted or the user denies it, the mini program multimedia API cannot access images in the system album.

Scan

If you use Scan or Scan AI:

  • For the window scanning function, you must apply for the following permission;

  • For the full-screen scanning function with multimedia or mini program multimedia integrated, you must apply for the following permission;

  • For the full-screen scanning function without multimedia or mini program multimedia, this permission is not required;

  • For the custom scanning function that uses multimedia components to access album images, you must apply for the following permission;

  • For the custom scanning function that calls the system album directly, this permission is not required;

Add this permission to AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>

You must also dynamically request this permission at an appropriate time. If the permission is not granted or the user denies it, the mPaaS multimedia component cannot access images in the system album when the user taps the album button.

Regression test

Devices used for full regression testing must include at least one device running Android 13 or later.

During regression testing, focus on the following component features (if applicable):

Components

Validation Item

Message Push Service

  • Verify that the self-built channel can display notifications after receiving messages

  • Verify that the vendor channel pushes messages normally

H5 container

  • Verify that file, image, and video selection works correctly

  • Verify that the page behaves correctly when the network changes while the page is open

Mini program

  • Verify that the multimedia API works correctly

Scan

  • Verify that selecting pictures from the album works correctly

Social sharing

  • Verify that sharing content to each platform works correctly

Threat awareness

  • Verify that each field of the basic information displays correctly