All Products
Search
Document Center

Initialize configuration

Last Updated: Apr 06, 2021

The configuration initialization covers the following four steps:

  1. Initialize mPaaS
  2. Configure Mini Program signature verification
  3. Configure AndroidManifest
  4. Apply for UC kernel

Initialize mPaaS

It is required to initialize mPaaS when you use the native AAR access method.

  1. Create the MyApplication class in the project.
    MyApplication
  2. Add the following code in the class.

    1. public class MyApplication extends Application {
    2. @Override
    3. protected void attachBaseContext(Context base) {
    4. super.attachBaseContext(base);
    5. // set mPaaS initialization callback
    6. QuinoxlessFramework.setup(this, new IInitCallback() {
    7. @Override
    8. public void onPostInit() {
    9. // Initialize mini program public resource package
    10. H5Utils.setProvider(H5AppCenterPresetProvider.class.getName(),new TinyAppCenterPresetProvider());
    11. }
    12. });
    13. }
    14. @Override
    15. public void onCreate() {
    16. super.onCreate();
    17. // Initialize mPaaS
    18. QuinoxlessFramework.init();
    19. }
    20. }
  3. Open AndroidManifest.xml, and add the following code in <application> label to set Application.

    1. android:name=".MyApplication"

Configure Mini Program signature verification

  1. Create the file custom_config.json under assets/config.
    custom_config
  2. Enter the following code in the file.

    1. [
    2. {
    3. "value": "NO",
    4. "key": "h5_shouldverifyapp"
    5. }
    6. ]

    If the value is “NO”, it means disabling mini program signature verification while “YES” means enabling signature verification. It is “YES” by default if no value is filled. In the development and debugging stage, you can disable signature verification for quick access. It is recommended to enable signature verification before releasing the mini program.

    For how to set mini program package signature verification, refer to Configure mini program package.

Configure AndroidManifest

Add the following code in the file AndroidManifest.xml.

  1. <application>
  2. ···
  3. <meta-data android:name="nebula.android.meta.enable" android:value="true"/>
  4. ···
  5. </application>

Apply for UC kernel

  1. Click mPaaS > Basic tool > Generate UC Key Signature to open the Query Signature window.
    generate uc key

  2. In the Query Signature window, enter the necessary configuration information, and click Next to continue.
    uc key

  3. Copy the generated SHA1 string.
    sha1

  4. Log in to the mPaaS console, and go to the Submit ticket page.

    1. Select the product to which the problem belongs. You can quickly search for mPaaS.
      select-mpaas

    2. Select the problem type. You can select Mini Program or Access Android.

    3. Select the expected solution Create ticket.
    4. On the ticket submission page, enter the following information to obtain the UC SDK Key.
      • Priority: Required, select Important or Normal based on the actual situation.
      • Problem description: Required, the following information is required.
        • Summary: For example, apply for UC SDK Key.
        • Package Name: In this tutorial, it is com.mpaas.demo.mpaasminiprogram.
        • SHA1: The SHA1 string obtained in above step.
      • Mobile: Required.
      • Email: Required.
  5. Click Submit. After a while, the technical support staff will give you a feedback.
    uc result

  6. Fill in the Key you obtained in the previous step into the file AndroidManifest.xml.
    1. <meta-data android:name="UCSDKAppKey" android:value="UC SDK Key information"/>
    Note: The authorization information of UC SDK is associated with the package name and signature of the apk. Therefore, if UCWebView doesn’t not work, you should check if the signature and package name are consistent with that used for applying for the key.

At this point, you have completed the initialization configuration.

Since mPaaS only supports armeabi architecture and targetSdkVersion 26, you need to add the following configuration to the file build.gradle under the main module of the project to adapt to the single armeabi CPU architecture and set targetSdkVersion.

  1. android {
  2. ···
  3. defaultConfig {
  4. ···
  5. targetSdkVersion 26
  6. ndk{
  7. abiFilters 'armeabi'
  8. }
  9. ···
  10. }
  11. ···
  12. }