MyWeb feature in SDK

In order to enhance the performance and rendering capability of mini programs, MYWeb module feature is supported. IAPMiniProgram SDK designs a unified module dynamic delivery solution that allows the super app to download and install the required modules per your requirements to run your application. MYWeb module can be integrated in the dynamic way.

Integration ways

You can choose one of the following integrations ways.

Note: It is highly recommended to use the Dynamic integration way.

Integrations way

Description

Static integration

The direct dependency is in the project, which is packaged into the APK along with the project.

Dynamic integration

Based on Google Dynamic Feature capability, download the APK from the Google Play Store when the application is opened. This can reduce the APK size when downloading and improve users' downloading experience.

Static integration

For MYWeb Feature, in the build.gradle file of the project app, add the iapminiprogram-myweb depedency as the following code sample:

Note: Obtain the latest iapminiprogram_version version in the Android Release Notes.

copy
dependencies {
    implementation "com.alipay.plus.android:iapminiprogram-myweb:{iapminiprogram_version}"
}

Dynamic integration

For details, see Support dynamic delivery solution in SDK.

Next steps

Configure the authorization code

After you integrate the MyWeb module/dynamic feature:

  1. You need to provide the package name of your application and SHA256 signature.
    We will provide you with the authorization code for MYWeb accordingly.
  2. Then in the Android project, you need to configure the authorization code for releaseand debug in the AndroidManifest.xml file and the build.gradle file. Refer to the following code sample:
  • AndroidManifest.xml file:
copy
    <application>
      <!-- configure ${activation_code} placeholder -->
      <meta-data
            android:name="com.alipay.myweb.init.ACTIVATION_CODES"
            android:value="${activation_code}"/>
    </application>
  • build.gradle file:
copy
android {
    buildTypes {
        release {
            /* configure the Release activation_code */
            manifestPlaceholders = [
                    activation_code: "mg*****...="
            ]
        }
        debug {
            /* configure the Debug activation_code*/
            manifestPlaceholders = [
                    activation_code: "4X*****...=="
            ]
        }
    }
}

Note:

  • If the authorization code is incorrect, MYWeb module/dynamic feature will not be enabled and will automatically fall back to the system web view (webview).
  • If you have multiple signatures and package names, need to configure the authorization code based on the different environment accordingly.

FAQ

For troubleshooting, refer to the Android SDK FAQ.