All Products
Search
Document Center

Mobile Platform as a Service:Use common components of mPaaS framework(optional)

Last Updated:Oct 14, 2022

This topic is intended to solve the adaptation problem with the general-purpose components of the native mPaaS framework when the component-based access mode is changed to the native AAR access mode. This topic can be ignored if general-purpose components of the mPassS framework are not used.

For compatibility with component-based access solutions, the following four components can be used in form of apt on 10.1.60 baseline or later versions:

Note

These four components are used in the same way as in component-based access mode. You can click a component name to view its details.

Use of Components

  1. Add related dependencies into library and application projects.

    implementation 'com.mpaas.mobile:metainfo-annotations:1.3.4'
    The apt access mode of kapt 'com.mpaas.mobile:metainfo-compiler:1.3.4' // kotlin
    The apt access mode of annotationProcessor  'com.mpaas.mobile:metainfo-compiler:1.3.4' // java
  2. Append specific annotations respectively when defining the preceding four components. There are four types of annotations:

    • @Application

    • @Service

    • @BroadcastReceiver

    • @Pipeline

    The parameter in annotation is the same as that defined in metainfo.xml. For example, when using @Application, you just need to do as follows:

    @Application(appId = "123123")
    public class MicroApplication extends ActivityApplication {
    }

When the library module is not used

If you do not use the library module, APP Module you only need to add it @MetaInfoApplication to any class in your project. If you use the easyconfig plug-in in combination (a common practice), you also need to turn on a switch. See the following examples:

@MetaInfoApplication(compatibleWithPlugin=true)

When the library module is used

If library module the preceding 4 components are defined in your project, you must perform the following operations:

  1. Declare any class, @MetaInfoLibrary and introduce the packageName of the library module for the parameter involved. For example:

    @MetaInfoLibrary(applicationId=BuildConfig.APPLICATION_ID)
  2. Add @MetaInfoApplication to any class in the app module project, and introduce the MetaInfoConfig.java generated in library module for dependency. For example:

    @MetaInfoApplication(dependencies={com.mylibrary.MetaInfoConfig.class})

    If you use the easyconfig plug-in in combination (a common practice), you also need to turn on a switch. The following shows the example in which an enable switch is integrated:

    @MetaInfoApplication(dependencies={com.mylibrary.MetaInfoConfig.class}, compatibleWithPlugin = true)

Obfuscation related

Add related classes into the obfuscation allowlist, especially com.alipay.mobile.core.impl.MetaInfoConfig. The following command can be used:

-keep public class com.alipay.mobile.core.impl.MetaInfoConfig