Initialize Appxiom SDK in Android
Appxiom SDK must be initialized in your Android application to enable advanced monitoring and error reporting. Initialization requires calling Ax.init() with your app credentials in the onCreate() method of your Application class.
Obtaining App Credentials
Before initializing the SDK, you need to obtain your app credentials from the Appxiom dashboard:
- Log in to Appxiom Dashboard: Visit https://app.appxiom.com and sign in to your account
- Create or Select App: Create a new app using the
+icon at the top left corner or select an existing one from the dropdown menu - Settings Page: Go to the settings page
- Get Credentials: Copy your
App KeyandPlatform Keyfrom the app settings page in Appxiom dashboard - Keep Secure: Store these keys securely in your project (consider using BuildConfig or string resources)
How to Initialize Appxiom SDK
Add the following code to your Application class with your app credentials:
- Java
- Kotlin
public class BlogApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize Appxiom SDK with your app credentials
// Replace with your actual App Key and Platform Key from Appxiom dashboard
String appKey = "your_app_key_here";
String platformKey = "your_platform_key_here";
Ax.init(this, appKey, platformKey);
}
}
class BlogApp : Application() {
override fun onCreate() {
super.onCreate()
// Initialize Appxiom SDK with your app credentials
// Replace with your actual App Key and Platform Key from Appxiom dashboard
val appKey = "your_app_key_here"
val platformKey = "your_platform_key_here"
Ax.init(this, appKey, platformKey)
}
}
Credential Management
For production apps, store your credentials securely using one of these methods:
Option 1: Using BuildConfig (Recommended)
- Java
- Kotlin
public class BlogApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Use BuildConfig for secure credential storage
Ax.init(this, BuildConfig.APPXIOM_APP_KEY, BuildConfig.APPXIOM_PLATFORM_KEY);
}
}
class BlogApp : Application() {
override fun onCreate() {
super.onCreate()
// Use BuildConfig for secure credential storage
Ax.init(this, BuildConfig.APPXIOM_APP_KEY, BuildConfig.APPXIOM_PLATFORM_KEY)
}
}
Option 2: Using String Resources
- Java
- Kotlin
public class BlogApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// Use string resources for credential storage
String appKey = getString(R.string.appxiom_app_key);
String platformKey = getString(R.string.appxiom_platform_key);
Ax.init(this, appKey, platformKey);
}
}
class BlogApp : Application() {
override fun onCreate() {
super.onCreate()
// Use string resources for credential storage
val appKey = getString(R.string.appxiom_app_key)
val platformKey = getString(R.string.appxiom_platform_key)
Ax.init(this, appKey, platformKey)
}
}
Testing Your Appxiom SDK Integration
After integrating the SDK, verify the connection between your app and the Appxiom dashboard.
Step 1: Trigger a Test Issue
Add Ax.test() immediately after Ax.init() in your onCreate() method:
- Java
- Kotlin
// Initialize SDK first
Ax.init(this, appKey, platformKey);
// Then trigger test issue
Ax.test();
// Initialize SDK first
Ax.init(this, appKey, platformKey)
// Then trigger test issue
Ax.test()
Step 2: Register Application Class
Ensure your custom Application class (e.g., BlogApp) is registered in your AndroidManifest.xml file.
Step 3: Run and Verify
- Launch your app on a device or emulator with an active internet connection.
- Visit the Appxiom dashboard to confirm the test issue appears.
- If the issue does not appear, check your app/platform selection or see the debug guide.
Remove the
Ax.test()call after verification to avoid repeated test issues.
Offline Caching Support
Appxiom SDK supports offline caching for issues that fail to sync. See the Offline Caching section for more details.
Once initialized, Appxiom SDK will automatically monitor and report network call issues, memory leaks, abnormal memory usage, ANRs, frame rate issues, and crashes in your application.
Frequently Asked Questions (FAQs)
Q: Where should I initialize Appxiom SDK in my Android app?
A: Always call Ax.init(this, appKey, platformKey) in the onCreate() method of your Application class with keys from the Appxiom dashboard.
Q: How do I get my App Key and Platform Key?
A: Log in to your Appxiom dashboard at https://app.appxiom.com, create or select your app, and copy the App Key and Platform Key from the app settings page.
Q: Where should I store my Appxiom credentials securely?
A: Use BuildConfig variables, string resources, or environment variables. Never hardcode credentials directly in your source code in production builds.
Q: What happens if I use incorrect App Key or Platform Key?
A: The SDK initialization will fail, and monitoring will not work. Verify your credentials in the Appxiom dashboard and ensure they match exactly.
Q: What happens if I forget to register my Application class in the manifest?
A: The SDK will not get initialized, and monitoring will not work. Always register your custom Application class in AndroidManifest.xml.
Q: Is it necessary to call Ax.test()?
A: Ax.test() is only for verifying integration. Remove it after confirming the test issue appears in the dashboard.
Q: My test issue is not showing up in the Appxiom dashboard. What should I do?
A: Ensure your device has internet access, verify your App Key and Platform Key are correct, check that the correct app/platform is selected in the dashboard, and confirm your Application class is registered. Refer to the debug guide if issues persist.
Q: Does Appxiom SDK work offline?
A: Yes, issues are cached offline and synced when the device is online.
For more information, refer to the official Appxiom SDK documentation or contact support.