Android Get Started

In this article, you will find step-by-step instructions to add Connectif Mobile SDK to your Android project. This begins the integration of your Mobile App with Connectif, once you have reviewed that you meet the prerequisites to perform it.

  

To perform this integration, you will need an expert with programming knowledge.

 

1. Requirements to add Connectif Mobile SDK to your Android project

  • You will need to have your Mobile App integration activated in Connectif to access the integration configuration for your key. You can check our implementation guide.
  • Developed as an Android library.
  • Minimum supported version Android 5.0 (Level 21).
  • Implemented in the app using Firebase Cloud Messaging for receiving push notifications.

 

2. How to add Connectif Mobile SDK to your Android project

2.1. Add the SDK

Add the SDK dependency to your build.gradle (Module: app) file.

Kotlin

implementation("ai.connectif:sdk:1.0.1")

Groovy

implementation 'ai.connectif:sdk:1.0.1'


Click on the Sync Now option in the top toolbar to sync the Gradle file.

 

2.2. Initialize the Connectif SDK

The best place to initialize our SDK is in the onCreate callback of the Application Class

Optionally, to obtain the email of users who registered or logged in before implementing the Connectif Mobile SDK, we will send the user's email when initializing the SDK. The email must meet the following requirements:

  • A valid email must have a username, followed by @, a domain, and an extension, with no spaces or special characters.
  • A maximum of 200 characters.

Example of the email: 

class SampleApp : Application() {
override fun onCreate() {
super.onCreate()
Connectif.init(
context = applicationContext,
apiKey = "YOUR_API_KEY",
"usermail@example.com"
)
}
}

 

3. Additional Configurations

Remember that when initializing the SDK, you can define some values using the ConnectifConfig parameter in Connectif.initialize().

3.1. Icon 

By default, this is the icon assigned to our push notifications:

ic_default_notification default_push_icon.png 

If you want, you can customize it by specifying the resource in the pushSmallIcon property of ConnectifConfig when initializing the SDK. Remember that for it to display correctly, it should only contain white and transparent colors.

3.2. Notification Channel

From Android 8 onwards, it is mandatory to create a channel to display notifications. By default, we assign the name "Default Channel" and the channel ID "connectif_channel" to the notifications shown by Connectif.

You can specify your custom channel name and ID using the pushChannelName and pushChannelId properties of ConnectifConfig when initializing the SDK.

3.3. Log

You can define the logLevel, i.e., the level of logs we want to show (default: LogLevel.NONE). Each level includes the logs from the previous level, so the INFO level will display all logs.

  • NONE: Disables all logs.
  • ERROR: Logs only errors.
  • WARN: Logs warnings and errors .
  • INFO: Logs informational messages, warnings, and errors.

 

4. Implementing User Tracking

Once you have configured the initialization, you can begin tracking the user by implementing the various notifications.

 

 

Congratulations!
You have reached the end of the lesson.

  

Do you have any unresolved questions?
Remember that you have access to our specialists at Connectif. To contact them, just open a Support ticket by clicking the blue “Help” button on your dashboard.


Keep learning!

To take full advantage of your Connectif account, we recommend continuing with the following articles:

Was this article helpful?
0 out of 0 found this helpful