# Prepare the Development Environment

This chapter will introduce how to integrate the SDK into a project you created.

# Prerequisites

  • Android SDK API level 16 or above

  • Android Studio 3.5 and above

  • Supports mobile devices with Android 4.1 or above

  • Effective Juphoon Developer Account (free sign up (opens new window))

  • Efficient Juphoon AppKey

# Create an Android project

Follow the steps below to create an Android project. If you already have an Android project, you can directly check the step of integrating JC SDK.

  1. Follow the steps below to create an Android project. If you already have an Android project, you can directly check the step of integrating JC SDK.

  2. On the Select a Project Template interface, select Phone and Tablet\Empty Activity, and then click Next.

  3. On the Configure Your Project interface, fill in the following in order:

    • Name: The name of your Android project, such as HelloJuphoon

    • Package name: The name of your project package, such as io.helloJuphoon.

    • Save location: the storage path of the project

    • Language: the programming language of the project, such as Java

    • Minimum API level: The minimum API level of the project

  4. Then click Finish. Follow the on-screen instructions to install plug-ins that may be required.

# Integrate SDK

You can integrate the JC SDK in one of two ways:

# Method 1: Use Maven to automatically integrate

  1. In the /Gradle Scripts/build.gradle(Project: <projectname>) file of the project, add JitPack to the list of repositories with the following lines::
...
allprojects {
    repositories {
        ...
        maven { url 'https://www.jitpack.io' }
    }
}
  1. In the /Gradle Scripts/build.gradle(Module: <projectname>.app) file of the project, integrate the SDK into your Android project by adding the following lines:
dependencies {
    ...
    // For x.y.z, fill in a specific SDK version number. For example, 2.9.0
    // See Release notes for the SDK version number.
    implementation 'com.github.juphoon-app:jcsdk:x.y.z'
}

# Method 2: Manually import JC SDK

  1. Download JC SDK (opens new window) and unpack it.

  2. Copy arm64-v8a , armeabi-v7a , x86 , x86_64 , JCSDK.jar , mtc.jar , and zmf.jar in the libs folder to the libs directory in your project directory.

  3. To make sure you can connect to the so library, you need to add Settings in the build.Gradle of your module:

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

# Add project permissions

According to the needs of scenarios, add the following line in the /app/src/main/AndroidManifest.xml file to obtain the corresponding device permissions:

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<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.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

TIP

When you configure permissions in AndroidManifest, please make sure that you can get permission to open the camera, audio and video recording and other related permissions.

# Prevent code obfuscation

Add the related classes of JC SDK to the unobfuscated list in the proguard-rules.pro file:

-dontwarn com.juphoon.*
-keep class com.juphoon.**{*;}
// bottom layer sdk
-dontwarn com.justalk.*
-keep class com.justalk.**{*;}
-keepattributes InnerClasses
-keep class **.R$* {*;}
最后更新时间: 12/9/2022, 11:33:45 AM