AppAmbit: Getting Started with Android
This guide walks you through setting up the AppAmbit Android SDK in your application, focusing on AppAmbit Analytics and Crash Reporting.
1. Prerequisites
Before getting started, ensure you meet the following requirements:
- Your project is configured in Android Studio
- The target devices run Android 5.0 (API level 21) or higher.
- You are not using another SDK for crash reporting.
2. Creating Your App in the AppAmbit Portal
- Visit AppAmbit.com.
- Sign in or create an account. Navigate to "Apps" and click on "New App".
- Provide a name for your app. Optionally, upload an image via drag-and-drop.
- Select the appropriate release type and Android OS.
- Click "Create" to generate your app.
- Retrieve the App Key from the app Info page.
3. Adding AppAmbit Android SDK modules
You can install the Android SDK from either:
Maven Central (recommended) — easiest to keep up-to-date
GitHub → Releases — direct download of tagged artifacts
- Open the build.gradle file at the project application level (app/build.gradle) and add the following lines after apply plugin.
Kotlin DSL
dependencies {
implementation("com.appambit:appambit:0.0.8")
...
}
Groovy
dependencies {
implementation 'com.appambit:appambit:0.0.8'
...
}
4. Initializing Android SDK
1 - Add the following line inside the onCreate
callback of your app's main Activity class to use AppAmbit
Java
AppAmbit.start(getApplicationContext(), "<YOUR-APPKEY>");
Kotlin
AppAmbit.start(this, "<YOUR-APPKEY>");
Warning
It is not recommended to insert the secret apikey directly into the code.
2 - Android Studio automatically suggests the necessary import statements once you insert the start()
method, but if you see an error indicating that the class names are not recognized, add the following line to the import statements of the Activity class:
Java
import com.appambit.sdk.AppAmbit;
Kotlin
import com.appambit.sdk.AppAmbit
This code automatically generates a session, the session management is automatic.
Android App Requirements
Add the following permissions in your AndroidManifest.xml
:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />