Updated on 2023-03-23 GMT+08:00

Getting Started

This document is intended for developers who have mastered some Android native development knowledge. It describes how to use the SDK to perform secondary development by taking the process of logging in to Huawei Cloud Meeting and initiating and joining a video meeting as an example.

Preparations

Prepare the following environment:

Environment requirements (mandatory)

The following environment provides reference for the personnel who compile and run the source code:

Environment requirements (optional)

SDK Integration

  1. Decompress the SDK package.

    Download and decompress the software package to obtain the files shown in the figure below.

    Figure 1 File directory

  2. Create a project.

    • Open Android Studio, choose File > New > New Project, choose Phone and Tablet > Empty Activity, and click Next.
    Figure 2 Creating a project
    • Enter project information and click Finish. (Note that the minimum Android API version is 23.)
    Figure 3 Setting project information

  3. Integrate the SDK.

    • In Android Studio, switch the project directory to Project.
      Figure 4 Switching to Project

    • Copy the .aar packages in the libs directory to your project directory.
      Figure 5 Adding the .aar packages

  4. Add dependencies.

    • Add a third-party dependency.

    The SDK depends on some open-source libraries. You must add dependencies on these libraries in Gradle as follows:

    Create the config.gradle file in the root directory of the project. (If you have created a unified configuration file, refer to the config.gradle file in the demo to configure the version.)

    Figure 6 Opening the config.gradle file
    • Add the following information to the first line of the build.gradle file:
      apply from:"config.gradle"
      The third-party dependency statement and version number used in config.gradle are as follows:
                  "rxandroid"              : 'io.reactivex.rxjava3:rxandroid:3.0.2',
                  "appcompat-v7"           : 'androidx.appcompat:appcompat:1.3.0',
                  "vectordrawable"         : 'androidx.vectordrawable:vectordrawable:1.2.0-alpha02',
                  "rxjava"                 : 'io.reactivex.rxjava3:rxjava:3.0.13',
                  "recyclerview"           : 'androidx.recyclerview:recyclerview:1.2.1',
                  "aspectjrt"              : 'org.aspectj:aspectjrt:1.9.6', 
                  "okhttp"                 : 'com.squareup.okhttp3:okhttp:4.9.1',
                  "gson"                   : 'com.google.code.gson:gson:2.8.9',
                  "design"                 : 'com.google.android.material:material:1.3.0',
                  "lifecycle-process"      : 'androidx.lifecycle:lifecycle-process:2.4.1',
                  "eventbus"               : 'org.greenrobot:eventbus:3.3.1',
                  "constraint-layout"      : 'androidx.constraintlayout:constraintlayout:2.0.4',
                  "glide"                  : 'com.github.bumptech.glide:glide:4.13.0',
                  "swiperefreshlayout"     : 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0',
                  "hms:scan-kit"           : 'com.huawei.hms:scan:2.1.0.300',
    Figure 7 Setting the build.gradle file

    • Add the open-source package dependencies and meeting SDK dependencies to app/build.gradle.

      The original Android Support Library is no longer maintained or evolved by Google. Therefore, Android 28 will be upgraded to AndroidX.

      Since the 70.8.5 version released in August, Huawei Cloud Meeting will no longer be developed based on the Support Library. Instead, AndroidX will be used for iteration.

      If you are still using the original Android Support Library dependency:

      • It is recommended that you change it to the AndroidX dependency. Otherwise, you may fail to connect to the AndroidX SDK version in subsequent development. For details, see Getting Started.
      • If you cannot upgrade to Android X as soon as possible, we will provide the original SDK developed based on the Support Library and maintain the SDK for six months. During the maintenance period, you can still integrate our SDK of 70.7.5 and earlier versions for development. Issues found in these versions will be fixed and updated. However, new functions in later iterations will be implemented only on the SDK of AndroidX.

      If you have any questions, dial 4000-955-988 or 950808 and press 1 and then 2.

       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
          // Some third-party frameworks used by the SDK
          api rootProject.ext.dependencies["appcompat-v7"]
          api rootProject.ext.dependencies["recyclerview"]
          api rootProject.ext.dependencies["design"]
          api rootProject.ext.dependencies["aspectjrt"]
          api rootProject.ext.dependencies["rxandroid"]
          api rootProject.ext.dependencies["constraint-layout"]
          api rootProject.ext.dependencies["glide"]
      
          implementation rootProject.ext.dependencies["rxjava"]
          implementation rootProject.ext.dependencies["gson"]
          implementation rootProject.ext.dependencies["eventbus"]
          implementation rootProject.ext.dependencies["okhttp"]
          implementation rootProject.ext.dependencies["hms:scan-kit"]
          implementation rootProject.ext.dependencies["lifecycle-process"]
          implementation rootProject.ext.dependencies["swiperefreshlayout"]
      
    • Add the meeting dependencies.
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
          implementation(name: 'HWMFoundation-release', ext: 'aar')
          implementation(name: 'HWMMobileCommonUI-release', ext: 'aar')
          implementation(name: 'HWMMobileConfUI-release', ext: 'aar')
          implementation(name: 'HWMPermission-release', ext: 'aar')
          implementation(name: 'HWMNativeSdk-release', ext: 'aar')
          implementation(name: 'HWMUiSdk-release', ext: 'aar')
          implementation(name: 'HWMCLink-release', ext: 'aar')
          if (needConfChat == null || needConfChat.toBoolean()) {
              implementation(name: 'imsdk-release', ext: 'aar')
          }
      

    If some modules are injected by themselves or are not opened, you do not need to add dependencies but must delete the corresponding .aar packages.

    These modules are:

    • Add the following to project/build.gradle allprojects/repositories:
      flatDir { dirs 'libs' }

    If Google cannot be connected, you can add your own Maven repository.

    Figure 8 Adding a Maven repository

    Figure 9 gradle-wrapper.properties
    • Choose Build > make project and wait until the project compilation is complete.

    If libc++_shared.so is integrated into the application layer, no configuration is required. If the dynamic library is used in the .aar package of a third-party library, you only need to add the following configuration in the build.gradle file:

    packagingOptions {

    merge lib/armeabi-v7a/libc++shared.so

    }

  5. Configure the obfuscation script.

    • Add the following information to the build.gradle file to configure the obfuscation script:
    buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
    }
    • Add the following information to the proguard-rules.pro file:
      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    # Do not enable optimization, because Android dex does not require optimize and preverify.
    -dontoptimize
    # Do not use case-sensitive class names. Windows users must set this option for ProGuard,
    # because Windows is case-insensitive. For example, a.java and A.java are considered as the same file.
    # If you do not do so and there are more than 26 classes in your project, ProGuard will use case-insensitive file names by default, causing class files to overwrite.
    -dontusemixedcaseclassnames
    # Specify that non-public library classes and members are not ignored.
    -dontskipnonpubliclibraryclasses
    -dontskipnonpubliclibraryclassmembers
    
    
    # If an exception is thrown, the code line number is kept unobfuscated to facilitate fault locating.
    -keepattributes SourceFile,LineNumberTable
    # Rename the file that throws an exception to facilitate fault locating.
    -renamesourcefileattribute SourceFile
    # A mapping file is generated after obfuscation.
    # This file contains the mappings between the class names and the obfuscated class names.
    # Use printmapping to specify the name of the file.
    -verbose
    
    
    # Preverify is not required. (Preverify is one of the four steps of ProGuard.)
    # Android does not require preverify. Remove this step to speed up obfuscation.
    -dontpreverify
    
    
    # The dump.txt file lists the internal structure of all classes in the .apk package.
    -dump class_files.txt
    # The seeds.txt file lists the classes and members that are not obfuscated.
    -printseeds seeds.txt
    # The usage.txt file lists the code deleted from the .apk package.
    -printusage usage.txt
    # The mapping.txt file lists the mapping before and after the obfuscation.
    -printmapping mapping.txt
    
    
    # Ignore the classes that are not modified by public in the library.
    # Non-public classes in the library cannot be used by programs. Ignore these classes to speed up obfuscation.
    # Note that this step cannot be performed in the following special case: The code written by the developer is in the same package as the classes in the class library, and the non-public classes of the package are used.
    #-skipnonpubliclibraryclasses
    
    
    # Keep the annotation unobfuscated, because the annotation is implemented through the reflection mechanism.
    -keepattributes *Annotation*
    # Keep the JavaScript interface unobfuscated.
    -keepattributes *JavascriptInterface*
    # Keep exceptions unobfuscated.
    -keepattributes Exceptions
    # Keep inner classes unobfuscated.
    -keepattributes InnerClasses
    # Keep the generics unobfuscated.
    -keepattributes Signature
    
    
    # Keep the local native methods unobfuscated.
    -keepclasseswithmembernames class * {
        native <methods>;
    }
    
    
    # Keep enumeration classes unobfuscated.
    -keepclassmembers enum * {
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }
    # Keep the Parcelable class unobfuscated.
    -keep class * implements android.os.Parcelable {
        public static final android.os.Parcelable$Creator *;
    }
    # Keep the Serializable class unobfuscated.
    -keepclassmembers class * implements java.io.Serializable {
        static final long serialVersionUID;
        private static final java.io.ObjectStreamField[] serialPersistentFields;
        !static !transient <fields>;
        !private <fields>;
        !private <methods>;
        private void writeObject(java.io.ObjectOutputStream);
        private void readObject(java.io.ObjectInputStream);
        java.lang.Object writeReplace();
        java.lang.Object readResolve();
    }
    
    
    # Keep the resource application name unobfuscated.
    -keepclassmembers class **.R$* {
        public static <fields>;
    }
    # Ignore the warnings in the support package.
    -dontwarn android.support.**
    # Keep the animations in the support package unobfuscated.
    -keep class android.support.annotation.Keep
    
    
    
    
    -keep @android.support.annotation.Keep class * {*;}
    -keepclasseswithmembers class * {
        @android.support.annotation.Keep <methods>;
    }
    -keepclasseswithmembers class * {
        @android.support.annotation.Keep <fields>;
    }
    -keepclasseswithmembers class * {
        @android.support.annotation.Keep <init>(...);
    }
    # Keep the system class libraries unobfuscated.
    -keep public class * extends android.app.Activity
    -keep public class * extends android.app.Application
    -keep public class * extends android.app.Service
    -keep public class * extends android.content.BroadcastReceiver
    -keep public class * extends android.preference.Preference
    -keep public class * extends android.content.ContentProvider
    -keep public class * extends android.view.View {
        public <init>(android.content.Context);
        public <init>(android.content.Context, android.util.AttributeSet);
        public <init>(android.content.Context, android.util.AttributeSet, int);
        public void set*(...);
    }
    
    
    # Keep Huawei SDK-related configurations unobfuscated.
    -keep class com.hianalytics.android.**{*;}
    -keep class com.huawei.updatesdk.**{*;}
    -keep class com.huawei.hms.**{*;}
    -keep class com.huawei.android.hms.agent.**{*;}
    
    
    # OKhttp obfuscation configuration.
    #https://github.com/square/okhttp/blob/5fe3cc2d089810032671d6135ad137af6f491d28/README.md#proguard
    -dontwarn okhttp3.**
    -dontwarn okio.**
    -dontwarn javax.annotation.**
    -dontwarn org.conscrypt.**
    # A resource is loaded with a relative path so the package of this class must be preserved.
    -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
    
    
    # Eventbus obfuscation configuration.
    #http://greenrobot.org/eventbus/documentation/proguard/
    -keepclassmembers class ** {
        @org.greenrobot.eventbus.Subscribe <methods>;
    }
    -keep enum org.greenrobot.eventbus.ThreadMode { *; }
    
    
    # Only required if you use AsyncExecutor
    #-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    #    <init>(java.lang.Throwable);
    #}
    
    
    # Keep HME java unobfuscated, because HMW-Video.jar will be invoked in C++.
    -keep class com.huawei.media.audio.AudioDeviceAndroid { *;}
    -keep class com.huawei.media.audio.AudioDeviceAndroidService { *;}
    -keep class com.huawei.media.audio.JniAudioDeviceImpl { *;}
    -keep class com.huawei.media.audio.JniAudioDeviceMeetingImpl { *;}
    -keep class com.huawei.media.audio.JniAudioDeviceRtcImpl { *;}
    -keep class com.huawei.media.video.Camera2Characteristic { *;}
    -keep class com.huawei.media.video.CaptureCapabilityAndroid { *;}
    -keep class com.huawei.media.video.DeviceInfo { *;}
    -keep class com.huawei.media.video.H264Decoder { *;}
    -keep class com.huawei.media.video.HmeDefinitions { *;}
    -keep class com.huawei.media.video.JNIBridge { *;}
    -keep class com.huawei.media.video.JNIBridgeImpl { *;}
    -keep class com.huawei.media.video.JNIMeetingImpl { *;}
    -keep class com.huawei.media.video.JNIRtcImpl { *;}
    -keep class com.huawei.media.video.KirinMediaCodecEncoder { *;}
    -keep class com.huawei.media.video.LogFile { *;}
    -keep class com.huawei.media.video.MediaCodecDecoder { *;}
    -keep class com.huawei.media.video.MediaCodecEncoder { *;}
    -keep class com.huawei.media.video.ScreenCaptureImageActivity { *;}
    -keep class com.huawei.media.video.SurfaceEncoder { *;}
    -keep class com.huawei.media.video.VideoCapture { *;}
    -keep class com.huawei.media.video.VideoCapture2Android { *;}
    -keep class com.huawei.media.video.VideoCaptureAndroid { *;}
    -keep class com.huawei.media.video.VideoCaptureDeviceInfo { *;}
    -keep class com.huawei.media.video.VideoCaptureDeviceInfoAndroid { *;}
    -keep class com.huawei.media.video.VideoRender { *;}
    -keep class com.huawei.media.video.VideoRenderNoGLES { *;}
    -keep class com.huawei.media.video.ViEAndroidGLES20 { *;}
    -keep class com.huawei.media.video.ViERenderer { *;}
    -keep class com.huawei.media.video.ViESurfaceRenderer { *;}
    -keep class com.huawei.media.video.VtNativeDecoder { *;}
    -keep class com.huawei.media.video.codec.KirinDecoder { *;}
    -keep class com.huawei.media.video.codec.KirinEncoder { *;}
    -keep class com.huawei.media.video.codec.** { *;}
    -keep class com.huawei.media.video.Camera2VideoCapture { *;}
    -keep class com.huawei.media.video.capture.Camera2EncodedImageReader { *;}
    -keep class com.huawei.media.video.capture.Camera2TextureImageReader { *;}
    -keep class com.huawei.media.video.capture.Camera2VideoCaptureImpl { *;}
    -keep class com.huawei.media.video.capture.Camera2YUVImageReader { *;}
    -keep class com.huawei.media.video.capture.CaptureRequestExKeyUtils { *;}
    -keep class com.huawei.media.video.capture.StreamConfig { *;}
    -keep class com.huawei.media.video.capture.StreamResolution { *;}
    -keep class com.huawei.media.video.capture.VideoCaptureDevInfoCamera2Impl { *;}
    -keep class com.huawei.media.mcuvideo.CaptureCapabilityAndroid { *;}
    -keep class com.huawei.media.mcuvideo.HmeDefinitions { *;}
    -keep class com.huawei.media.mcuvideo.JNIBridge { *;}
    -keep class com.huawei.media.mcuvideo.LogFile { *;}
    -keep class com.huawei.media.mcuvideo.MediaCodecDecoder { *;}
    -keep class com.huawei.media.mcuvideo.MediaCodecEncoder { *;}
    -keep class com.huawei.media.mcuvideo.VideoCapture { *;}
    -keep class com.huawei.media.mcuvideo.VideoCaptureDeviceInfo { *;}
    -keep class com.huawei.media.mcuvideo.VideoRender { *;}
    -keep class com.huawei.media.mcuvideo.VideoRenderNoGLES { *;}
    -keep class com.huawei.media.mcuvideo.ViERenderer { *;}
    -keep class com.huawei.media.mcuvideo.codec.** { *;}
    -keep class com.huawei.media.mcuvideo.capture.Camera2EncodedImageReader { *;}
    -keep class com.huawei.media.mcuvideo.capture.Camera2TextureImageReader { *;}
    -keep class com.huawei.media.mcuvideo.capture.Camera2VideoCaptureImpl { *;}
    -keep class com.huawei.media.mcuvideo.capture.Camera2YUVImageReader { *;}
    -keep class com.huawei.media.mcuvideo.capture.CaptureRequestExKeyUtils { *;}
    -keep class com.huawei.media.mcuvideo.capture.StreamConfig { *;}
    -keep class com.huawei.media.mcuvideo.capture.StreamResolution { *;}
    -keep class com.huawei.media.mcuvideo.capture.VideoCaptureDevInfoCamera2Impl { *;}
    -keep class com.huawei.media.oldvideo.CaptureCapabilityAndroid { *;}
    -keep class com.huawei.media.oldvideo.HmeDefinitions { *;}
    -keep class com.huawei.media.oldvideo.JNIBridge { *;}
    -keep class com.huawei.media.oldvideo.LogFile { *;}
    -keep class com.huawei.media.oldvideo.MediaCodecDecoder { *;}
    -keep class com.huawei.media.oldvideo.MediaCodecEncoder { *;}
    -keep class com.huawei.media.oldvideo.VideoCapture { *;}
    -keep class com.huawei.media.oldvideo.VideoCaptureDeviceInfo { *;}
    -keep class com.huawei.media.oldvideo.VideoRender { *;}
    -keep class com.huawei.media.oldvideo.VideoRenderNoGLES { *;}
    -keep class com.huawei.media.oldvideo.ViERenderer { *;}
    -keep class com.huawei.media.oldvideo.codec.** { *;}
    
    
    # Keep TUP Java unobfuscated, because it will be invoked in C++.
    -keep class tupsdk.Tupmedia { *;} #TupCall.jar
    -keep class com.huawei.media.data.Conference { *;}  #TupConf.jar
    
    -keep class imssdk.** { *;}
    
    # RTC SDK obfuscation
    -keep class com.huawei.rtc.**{*;}
    
    -keep class com.huawei.allplatform.**{*;}
    
    ## Native SDK obfuscation
    -keep class com.huawei.hwmsdk.**{*;}
    
    # Keep WebViewInterface unobfuscated.
    -keepclassmembers class com.huawei.hwmclink.jsbridge.model.GHConfigModel {
      public *;
    }
    
    # Keep APIs unobfuscated.
    -keep public class com.huawei.**.*Api { *;}
    -keep class com.huawei.cloudlink.openapi.api.ICloudLinkOpenApi{*;}
    -keep class com.huawei.cloudlink.openapi.api.impl.CloudLinkOpenApiImpl{*;}
    -keep class com.huawei.hwmbiz.IBizOpenApi{*;}
    -keep class com.huawei.hwmbiz.impl.BizOpenApiImpl{*;}
    
    
    # Keep microservices unobfuscated. It is called using reflection. For details, see the Huawei Cloud configuration.
    -keep public class * extends com.huawei.hwmfoundation.microservice.HCMicroService
    -keep public class * extends com.mapp.hcmobileframework.microapp.HCMicroApplicationDelegate
    -keep public class * implements com.huawei.hwmclink.jsbridge.bridge.** {*;}
    
    
    # Keep the constructors for the classes inherited from AbsCache unobfuscated, regardless of whether they are being used. Otherwise, the constructors will be optimized.
    -keepclassmembers class * {
        <init>(...);
    }
    # Keep RXJava unobfuscated, because there are hook operations inside it.
    -keep class io.reactivex.**{*;}
    # Keep custom annotations unobfuscated.
    -keep public class com.huawei.hwmbiz.aspect.CheckToken
    -keep public class com.huawei.hwmfoundation.hook.annotation.TimeConsume
    -keep public class com.huawei.hwmfoundation.hook.annotation.HookDisable
    -keep public class com.huawei.hwmfoundation.hook.annotation.HookNotNeeded
    
    
    # Keep glide unobfuscated.
    -keep class com.github.bumptech.glide.**{*;}
    # Conversion from the JSON format into the javabean format is required. Obfuscation is not needed.
    -keep public class * extends com.huawei.hwmfoundation.base.BaseModel{*;}
    
    
    # Keep HMS SDK unobfuscated.
    -ignorewarnings
    -keepattributes *Annotation*
    -keepattributes Exceptions
    -keepattributes InnerClasses
    -keepattributes Signature
    -keepattributes SourceFile,LineNumberTable
    -keep class com.hianalytics.android.**{*;}
    -keep class com.huawei.updatesdk.**{*;}
    -keep class com.huawei.hms.**{*;}
    
    
    # AndroidX obfuscation configuration.
    -keep class com.google.android.material.** {*;}
    -keep class androidx.** {*;}
    -keep public class * extends androidx.**
    -keep interface androidx.** {*;}
    -dontwarn com.google.android.material.**
    -dontnote com.google.android.material.**
    -dontwarn androidx.**
    # Keep the route table unobfuscated. After the startup, the route table is summarized from the fixed package.
    -keep class com.huawei.cloudlink.router.routermap.** {*;}
    
    
    # crashreport obfuscation configuration.
    -keep public class com.huawei.crashreport.**{*;}
    
    
    # IMSDK obfuscation configuration.
    -keep class com.huawei.imsdk.ECSProxy {*;}
    -keep class com.huawei.imsdk.msg.** {*;}
    
    # Keep HWMUserState unobfuscated.
    -keep public class com.huawei.cloudlink.openapi.model.HWMUserState{*;}
    
    # Keep netty unobfuscated. It is used for projection.
    -keep class io.netty.**{*;}
    

  6. Add permissions.

    Add permissions required in the AndroidManifest.xml file.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <!--Enable the foreground server to keep alive during the meeting.-->
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    

  7. Add the screen sharing service.

    To use the screen sharing function, add the following service statement to the AndroidManifest.xml file:
    1
    2
    3
    4
    <!-- Add the following configuration to the SDK. If the value of compileSdkVersion is greater than or equal to 29, add android:foregroundServiceType="mediaProjection". Otherwise, delete android:foregroundServiceType="mediaProjection".-->
    <service android:name="com.huawei.hwmconf.sdk.ScreenRecorderService" 
    4ce9861d-fad1-42b6-807c-fbf8a0c2320e2412108500276004ce9861d-fad1-42b6-807c-fbf8a0c2320e241210850027600android:exported="false"
            android:enabled="true"/>
    

  8. Initialize the SDK.

    • The initialization must be placed in onCreate of the application, and it must be called as early as possible so that the SDK can obtain the current activity and jump to a specified page by listening to the activity lifecycle.
      1
      2
      3
      4
      5
      OpenSDKConfig sdkConfig = new OpenSDKConfig(this)        
               .setAppId("fdb8e4699586458bbd10c834872dcc62")    // Set a unique app ID. The application name can be entered. This parameter is mandatory when the app ID is used for login.
               .setServerAddress(DBConfig.Default.getInstance().getServerAddress())   // Set the IP address of the meeting server.
               .setServerPort(DBConfig.Default.getInstance().getServerPort());  // Set the port of the meeting server.
      HWMSdk.init(this,sdkConfig);
      

  9. Learn the examples.

    • Login API
      1
      HWMSdk.getOpenApi(Application).login(LoginParam, HwmCallback<LoginResult>);
      
    • API for creating a meeting
      1
      HWMSdk.getOpenApi(Application).createConf(CreateConfParam, HwmCancelableCallBack<ConfInfo>);
      
    • API for joining a meeting
      1
      HWMSdk.getOpenApi(Application).joinConf(JoinConfParam, HwmCancelableCallBack<Void>);
      
    • API for initiating a call
      1
      HWMSdk.getOpenApi(Application).startCall(CallParam, HwmCancelableCallBack<Void>);
      
    • API for logout
      1
      HWMSdk.getOpenApi(Application).logout(HwmCallback<LoginCompletedResult>);
      

    After the preceding steps are complete, you can run the new demo project.