mPaaS has supported targetSdkVersion 31 from mPaaS 10.2.3.4. If your application requires targetSdkVersion 31, see Use mPaaS plug-in to upgrade the SDK to 10.2.3.4 or later, and then perform adaptation and regression as shown in the following steps.
Adapt to targetSdkVersion 31
Prerequisites
mPaaS is adapted to targetSdkVersion 28, targetSdkVersion 29, and targetSdkVersion 30. For more information, see Adapt mPaaS to targetSdkVersion 28, Adapt mPaaS to targetSdkVersion 29, and Adapt mPaaS to targetSdkVersion 30.
mPaaS is adapted to baseline 10.2.3 in accordance with mPaaS 10.2.3 upgrade guide.
Change the value of targetSdkVersion
Native AAR integration mode
Open the build.gradle
file in the main module of the project and change the value of the targetSdkVersion attribute to 31.
Componentized integration mode
Open the
build.gradle
file in the main module of the Portal project and change the value of the targetSdkVersion attribute to 31.In the Bundle project, the value of the targetSdkVersion attribute can retain unchanged. But the value of the targetSdkVersion attribute must be less than or equal to that in the Portal project.
Securer component export
For the applications of targetSdkVersion 31, the exported
attribute should be declared explicitly for the Activity, Service, and BroadcastReceiver containing intent-filter
.
Social Sharing
To integrate sharing to QQ, add the following configuration in
AndroidManifest.xml
:<!-- To share to QQ, target 31 adaptation needs to be merged. --> <activity android:name="com.tencent.tauth.AuthActivity" android:launchMode="singleTask" android:exported="true" android:noHistory="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- The QQ share ID is in the format of "tencent + QQ share ID". You need to ensure that the QQ share ID is the same as that configured in the code, otherwise the sharing callback may be exceptional.--> <data android:scheme="xxxxx" /> </intent-filter> </activity>
To integrate sharing to Weibo, add the following configuration in AndroidManifest.xml:
<!-- To share to Weibo, target 31 adaptation needs to be merged. --> <activity android:name="com.sina.weibo.sdk.share.WbShareResultActivity" android:configChanges="orientation|screenSize|keyboardHidden" android:exported="true" android:launchMode="singleTop" android:theme="@android:style/Theme.Translucent.NoTitleBar" tools:replace="configChanges"> <intent-filter> <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_STORY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
Message Push Service (MPS)
To integrate Message Push Service (MPS), see Integrate MPS into Android to add the
exported
attribute tocom.alipay.pushsdk.BroadcastActionReceiver
.To integrate Huawei push HMS5 by vendor channels, see Huawei push document to upgrade to the adapted version. If the version cannot be upgraded for the time being, add the following configuration in
AndroidManifest.xml
:<!-- To use Huawei push, target 31 adaptation needs to be merged. --> <receiver android:name="com.huawei.hms.support.api.push.PushMsgReceiver" android:directBootAware="true" android:exported="true"> <intent-filter> <action android:name="com.huawei.intent.action.PUSH_DELAY_NOTIFY" /> <action android:name="com.huawei.intent.action.PUSH" /> </intent-filter> </receiver> <receiver android:name="com.huawei.hms.support.api.push.PushReceiver" android:directBootAware="true" android:exported="true"> <intent-filter> <action android:name="com.huawei.android.push.intent.REGISTRATION" /> <action android:name="com.huawei.android.push.intent.RECEIVE" /> </intent-filter> </receiver>
To integrate Huawei push HMS2 by vendor channels, see Integrate Huawei push - HMS2.x to add the
exported
attribute forcom.
huawei
.hms.update.provider.UpdateProvider
andcom.alipay.pushsdk.thirdparty.huawei.HuaweiPushReceiver
.To integrate OPPO push by vendor channels, see OPPO version release notes to upgrade to the adapted version, and see OPPO push to add the
exported
attribute toCompatibleDataMessageCallbackService
andDataMessageCallbackService
.
UC kernel
To use the feature of capturing crash events of the UC kernel, see Capture crash events of UC kernel to add the exported
attribute for ClientMonitorWakeupReceiver
.
Regression test
Ensure that Android 12 or later devices are included in the full regression test. In the regression test, focus on the components and their features, if in use, shown in the following table.
Component | Test item |
Mobile Gateway Service (MGS) |
|
Message Push Service (MPS) |
|
Mini program |
|
Mobile Delivery Service (MDS) upgrade |
|
Social Sharing |
|
Intelligent Dual-Recording System |
|