3. Installing the Bayun SDK

3.1 Adding the Bayun SDK

  • In your Android Studio application, right click on the project and select "New" -> "Module".
  • In the window that opens, select "Import .JAR/.AAR Package", and click "Next".
  • In the next window, mention the path of the Bayun archive under "File Name" and give the module sub-project a name.
  • Navigate to your build.gradle file and ensure that you include the following:
dependencies {
    implementation project(':<sub-project name>')
}
  • The Bayun SDK requires some dependencies that couldn't be included in the archive itself. For the SDK to work, these dependencies must be added by the app implementing the Bayun SDK. In the "build.gradle" file of the "app" module of your application, add the following code.
dependencies {
    ....
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.1'
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
    implementation 'com.github.tony19:logback-android:2.0.0'
    implementation 'androidx.biometric:biometric:1.0.1'
}
  • If your application uses Java and not Kotlin, you might need to also add another dependency that will form a bridge between the Kotlin dependencies of the SDK and your Java code.
dependencies {
    ....
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.61"
}

3.2 AndroidManifest.xml

The Bayun Android SDK requires some permissions and references from your app’s AndroidManifest.xml file. These permissions allow the SDK to monitor network state.

<!-- Standard permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

The Bayun Android SDK contains a service and an activity that must be declared in your app's AndroidManifest.xml file, for it to work.

<!-- Declare Bayun SDK's background service -->
service android:name="com.bayun_module.BayunBackgroundService"/>
<!-- Declare Bayun SDK's background activity for screen locks -->
service android:name="com.bayun_module.EmptyActivity"/>

results matching ""

    No results matching ""