- Notifications
You must be signed in to change notification settings - Fork0
Custom Android Chat API & SDK. Android sample app with basic UI integrated with our latest SDK, enabling easy customization to build your own communication app.
MirrorFly/MF-Android-UIKIT-SDK
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
With CONTUS MirrorFlyChat SDK for Android, you can efficiently integrate the desired real-time chat features into a client app.
When it comes to the client-side implementation, you can initialize and configure the uikitsdk with minimal efforts. With the server-side, MirrorFly ensures reliable infra-management services for the chat within the app. This page will let you know how to install the UI-KIT SDK in your app.
Note : If you're looking for the fastest way in action with CONTUS MirrorFlyChat SDKs, then you need to build your app on top of our sample version. Simply download the sample app and commence your app development. To download sample appclick here
The requirements for UI-KIT SDK for Android are:
- Android Marshmallow 6.0 (API Level 23) or above
- Java 8 or higher
- Gradle 4.1.0 or higher
Step 1: Create a new project or Open an existing project in Android Studio
Step 2: If using Gradle 6.8 or higher, add the following code to your settings.gradle file. If using Gradle 6.7 or lower, add the following code to your root build.gradle file. Seethis release note to learn more about updates to Gradle.
dependencyResolutionManagement { repositories { jcenter() maven { url"https://repo.mirrorfly.com/release" } }}Step 3: Add the following dependencies in the app/build.gradle file.
dependencies { implementation'com.mirrorfly.uikitsdk:mf-uikitsdk:1.0.37' }Step 4: Add the below dependencies required by the SDK in the app module/build.gradle file.
buildscript { dependencies { classpath'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'def nav_version="2.3.5" classpath"androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"}}Step 5: Add the below line in the gradle.properties file, to avoid imported library conflicts.
android.enableJetifier=trueStep 6: Open the AndroidManifest.xml and add below permissions.
<uses-permissionandroid:name="android.permission.INTERNET" />
To integrate and run Mirrorfly UIKit in your app, you need to initialize it first.You can initialize the MirrorFlyUIKit instance by passing the MirrorFlyUIKitAdapter instance as an argument to a parameter in the MirrorFlyUIKit.init() method.The MirrorFlyUIKit.init() must be called once in the onCreate() method of your app’s Application instance.
Note: While registration, the below
registerUsermethod will accept theFCM_TOKENas an optional param and pass it across.
Step 1: Add the below line in the application class file.
packagecom.example.mfuikittestimportandroid.app.Applicationimportcom.mirrorflyuikitsdk.MirrorFlyUIKitimportcom.mirrorflyuikitsdk.adapter.MirrorFlyUIKitAdapterclassBaseApplication :Application() {overridefunonCreate() {super.onCreate()MirrorFlyUIKit.initFlySDK(applicationContext,object:MirrorFlyUIKitAdapter {overridefunsetAppName():String? {return"YOUR_APP_NAME" }overridefunsetApplicationID():String? {return"YOUR_APPLICATION_ID" }//Below override methods are optional used for customizationoverridefunisCallEnabled():Boolean? {returntrue }overridefunisGroupEnable():Boolean? {returntrue }overridefunisContactEnable():Boolean? {returntrue }overridefunisLogoutEnable():Boolean? {returntrue }overridefunisOtherProfileEnable():Boolean? {returntrue }overridefunisOwnProfileEnable():Boolean? {returntrue }overridefunsetGoogleTranslationKey():String? {return getString(R.string.google_key) }overridefunonlyOnetoOneChat():Boolean? {returnfalse } })MirrorFlyUIKit.defaultThemeMode=MirrorFlyUIKit.ThemeMode.LightMirrorFlyUIKit.loginActivity="LoginActivity"::class.java }}
Step 2: Add the below line in the Launcher class file.
classSplashTestActivity :AppCompatActivity() {overridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState) setContentView(R.layout.activity_splash)MirrorFlyUIKit.initializeSDK(this@SplashTestActivity,SplashTestActivity::class.java,"YOUR_LICENCE_KEY",object:FlyInitializeSDKCallback{overridefunflyError(isSuccess:Boolean,throwable:Throwable?,data:HashMap<String,Any> ) {//TODO Error Handling }overridefunredirectToDashBoard(isSuccess:Boolean) { startActivity(Intent(this@SplashTestActivity,MFUIDemoActivity::class.java)) finish() }overridefunredirectToLogin(isSuccess:Boolean) { startActivity(Intent(this@SplashTestActivity,MainActivity::class.java)) finish() } }) }}
MirrorFlyUIKit.initUser("USER_IDENTIFIER","FIREBASE TOKEN",object:InitResultHandler {overridefunonInitResponse(isSuccess:Boolean,e:String) {if (isSuccess) {Log.d("TAG","onInitResponse called with: isSuccess =$isSuccess") }else {Log.e("TAG","onInitResponse called with: Failure, e =$e") } } })
DashBoardActivity is the starting point for launching UIKit in your application. By implementing the code below, you will see a complete list of recent chats that you're made with single and group conversation.
importandroidx.appcompat.app.AppCompatActivityimportandroid.os.Bundleimportcom.mirrorflyuikitsdk.activities.DashBoardActivityclassMainActivity :DashBoardActivity() {// Add this line.overridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState)// If you’re going to inherit `DashBoardActivity`, don’t implement `setContentView()` }}
About
Custom Android Chat API & SDK. Android sample app with basic UI integrated with our latest SDK, enabling easy customization to build your own communication app.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.