All Products
Search
Document Center

Mobile Platform as a Service:Adapt mPaaS to targetSdkVersion 31

Last Updated:Mar 13, 2023

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

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 to com.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 for com.huawei.hms.update.provider.UpdateProvider and com.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 to CompatibleDataMessageCallbackService and DataMessageCallbackService.

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)

  • Check whether mPaaS GMSSL is normal.

Message Push Service (MPS)

  • Check whether messages can be pushed by vendor channels successfully.

  • Check whether a message can be redirected normally upon a tap.

Mini program

  • Check whether the Bluetooth API is normal.

Mobile Delivery Service (MDS) upgrade

  • Check whether the upgrade package can be downloaded and canceled normally.

Social Sharing

  • Check whether the content can be shared to the supported platforms.

Intelligent Dual-Recording System

  • Check whether initialization is normal.

  • Check whether each atomic capability is normal.