Project Configuration

Last updated: 2020-05-11 17:07:40

    This document describes how to configure an Android project for GME APIs for Android.

    SDK Preparations

    1. Download the applicable demo and SDK. For more information, please see Download Guide.
    2. Decompress the obtained SDK resources.
    3. The SDK development resources are in the libs folder.

    The SDK is supported on Android 4.2 or above; however, hardware encoding can be enabled only on Android 4.3 (API 18) or above.

    Configuration Guide

    SDK file import

    1. Copy the gmesdk.jar file in the libs directory to the libs directory of the Android project.
    2. Copy the library files of the corresponding architecture according to the project requirements. For example, if the project requires the armeabi-v7a architecture, please copy the library files in the armeabi-v7a directory to the armeabi-v7a directory of the project (if the project does not have the armeabi-v7a directory, please create one).

    Project configuration

    Add the code that imports the library into build.gradle in the App directory of the project.

    sourceSets {
            main {
                jniLibs.srcDirs = ['libs']
            }
    }

    Application permission configuration

    Add the following permissions in the AndroidManifest.xml file of the project:

      <uses-permission android:name="android.permission.RECORD_AUDIO" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
      <uses-permission android:name="android.permission.BLUETOOTH"/>
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    If the voice messaging and speech-to-text feature is to be used, add the following under the application node in the manifest file:

      <application android:usesCleartextTraffic="true" >

    Code obfuscation

    If you want to obfuscate the code, configure the following:

    -dontwarn com.tencent.**
    -keep class com.tencent.** { *;}
    -keepclassmembers class com.tencent.**{*;}

    Advanced Android Configuration

    According to Behavior changes: all apps for Android 9 on the Android Developers platform, Android 9 limits background apps' access to user inputs and sensor data, that is, apps running in the background cannot access the mic or camera.
    If Android 9 users need to continue capturing audio or video after locking the screen, a service can be initiated before the screen is locked or the app is brought to the background and terminated before the screen is unlocked or the app is brought to the foreground.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help