Quickstart
Channelize.io Android UI SDK helps you build real-time messaging with pre-built screens. It provides you various methods to initialize and configure UI SDK and set the data into various pre-built screens.
NOTE: Channelize.io Android UI SDK is using Channelize.io Android API SDK for networking and real-time events.
Install and configure Android UI SDK
Step 1: Create your Channelize.io Application
To initialize SDK you need to pass the Public Key of you application to accesss Android API SDK, which you will get from the Channelize.io dashboard under My Account > Application Settings for the respective application.
Step 2: Install the SDK
To install the UI SDK using .gradle, add the following lines to a build.gradle file at the app level.
build.gradle
dependencies {
implementation 'com.github.ChannelizeIO.Channelize-Android-SDK:channelizeui:4.3.3'
}
Step 3: Grant system permissions
To use all features of Android UI SDK grant system permissions by adding the following lines to the AndroidManifest.xml file.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
NOTE: Add all the meta-data inside <application>
tag.
To use the Stickers & GIFs feature in UI SDK add the Giphy API KEY inside your AndroidManifest.xml
file. Replace the "API_KEY" in value with your Giphy API KEY that you'll get after registering an account on giphy.com.
<meta-data android:name="com.channelize.giphy.API_KEY"
android:value="API_KEY" />
To use the Location feature in UI SDK add the Google Places API KEY inside your AndroidManifest.xml
file. Replace the "API_KEY" in value with your Google Places API KEY.
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="API_KEY" />
Add PUSH_NOTIFICATION_ICON that you want to show as small icon on push notifications.
<meta-data android:name="com.channelize.messenger.notification.smallIcon"
android:resource="@drawable/PUSH_NOTIFICATION_ICON" />
Add COMPLETE_PACKAGE_PATH_OF_ACTIVITY that you want to launch if user click on push notification if you want to launch Channelize.io home screen than put the value @string/pm_push_notification_open_activity_name.
<meta-data android:name="com.channelize.messenger.activity.open.notification"
android:value="COMPLETE_PACKAGE_PATH_OF_ACTIVITY" />
Integrate UI SDK
Step 1: Initialize the SDK
SDK initialization will bind the SDK to Android’s context, thereby allowing it to respond to the connection and state changes. The ChannelizeUI.initialize(channelizeUIConfig)
method should be called once across the application. Initializing the Android UI SDK in the onCreate()
method of the Application instance is recommended.
// To customize the UI, access the ChannelizeUIConfig class and set the customized method's value. Few of them are mentioned below.
ChannelizeUIConfig channelizeUIConfig = new ChannelizeUIConfig.Builder()
.enableForward(false) // To show the forward message option in the conversation screen.
.enableQuoteMessage(false) // To show the quote message option in the conversation screen.
.showDateHeader(false) // To show the date header in the conversation screen.
.enableVoiceRecorder(false) // To show the voice recorder option in the conversation screen.
.build();
ChannelizeUI.initialize(channelizeUIConfig);
Step 2: Connect to Channelize server
To get the updates in UI SDK, you need to connect to the Channelize.io server to publish/receive the real-time updates.
Channelize.connect();
Launch Channelize UI SDK
To launch the home page of the Channelize Messaging use the following code.
Intent intent = new Intent(context, ChannelizeMainActivity.class);
startActivity(intent);