Before Getting Started
Overview
Clix leverages Firebase Cloud Messaging (FCM) to deliver notifications efficiently. The goal is to ensure a smooth integration process and reliable delivery of push notifications to your app users.Environment
- Android API level 26 (Android 8.0) or later
- Firebase account
Make sure you’ve completed the Firebase setup.If the setup is complete, the following items should be in place:
- Make sure google-services.json is in your project directory.
- Upload the Service Account Key file to the Clix console.
Setup Clix - Using CLI (Recommended)
Clix CLI is an AI-powered assistant for quick and easy SDK setup. Use the install and doctor commands to automatically configure the required code and settings.Install Clix CLI
Run Install Command
The install command checks for required files and configurations, then guides you through the installation process with interactive prompts.Doctor Command
The clix doctor command verifies that your Clix SDK setup is correct and provides guidance on fixing any issues.Setup Clix - Manual Installation
Integrate Firebase and Clix to manage and send notifications effectively from
Clix console.
1. Installation
1. Installation
Clix Android SDK supports installation only via Gradle (Kotlin DSL).
(Option 1) Using Version Catalog (Recommended)
If you’re using the Gradle Version Catalog (libs.versions.toml), follow the steps below for more consistent dependency management.- Add the version and library alias to
gradle/libs.versions.toml(create the file if it doesn’t exist):
-
(Optional) If you use a custom catalog file name, adjust the accessor accordingly. If you’re using the default (
libs), no extra configuration is required. -
In your app module’s
build.gradle.kts:
When Gradle generates accessors, hyphens (-) in the alias are converted to dots (.) resulting in libs.clix.android.sdk.
(Option 2) Without Version Catalog (Direct Declaration)
Add the following to your project’ssettings.gradle.kts or build.gradle.kts:build.gradle.kts:build.gradle.kts:2. Initialize Clix with Config
2. Initialize Clix with Config
Add this code to your
Application class. The endpoint and logLevel parameters are optional. If your project doesn’t have an Application class, refer to this link to add one.Application.kt
3. Add Permission Code
3. Add Permission Code
Add this code to your By default,
Application class, right after the Clix.initialize code.Application.kt
autoRequestPermission is set to false, which means the app will not automatically request push notification permission.There are two options to implement the push notification permission flow:(Option 1) Automatically request permission right after app launch
Simply setautoRequestPermission to true.Application.kt
(Option 2) Manually control when to show the permission prompt
If you want to request permission at a specific point in your app, leave it asfalse and call the following code when you’re ready to request permission.MainActivity.kt
4. Build & Run
4. Build & Run
Run your project to verify that the setup works correctly. Go to Clix console > Test Console, find the registered device, send a test push notification, and confirm that the message is received on the device. Also, make sure the push events are being tracked in real time.
If you’re using an emulator, make sure it is started with Cold Boot to properly test push notification delivery. For more details, see this guide.