mPaaS 10.2.3.4 and later support targetSdkVersion 31. To upgrade, use Use mPaaS plug-in to update the SDK to 10.2.3.4 or later, and then follow the adaptation and regression steps below.
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.gradlefile in the main module of the Portal project and change the value of the targetSdkVersion attribute to 31.In the Bundle project, the targetSdkVersion value can remain unchanged, but it must be less than or equal to the value in the Portal project.
Securer component export
For applications targeting targetSdkVersion 31, you must explicitly declare the exported attribute for any Activity, Service, or BroadcastReceiver that contains an 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
exportedattribute 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
exportedattribute forcom.huawei.hms.update.provider.UpdateProviderandcom.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
exportedattribute toCompatibleDataMessageCallbackServiceandDataMessageCallbackService.
UC kernel
To capture crash events from the UC kernel, see Capture crash events of UC kernel to add the exported attribute for ClientMonitorWakeupReceiver.
Regression test
Include Android 12 or later devices in the full regression test. Focus on the following components and features if they are in use.
Component | Test item |
Mobile Gateway Service (MGS) |
|
Message Push Service (MPS) |
|
Mini program |
|
Mobile Delivery Service (MDS) upgrade |
|
Social Sharing |
|
Intelligent Dual-Recording System |
|