Zoho SalesIQ Mobilisten Flutter Plugin

Connect with customers at every step of their journey. Give them the best in-app live chat experience with Mobilisten. Mobilisten enables customers to reach you from any screen on your app, get their questions answered, and make better purchase decisions.

Note:
Zoho SalesIQ is GDPR Compliant! The configurations for the website and Mobile SDK remain the same if you have already configured on your site, it will be automatically reflected in Mobile SDK. If not, then learn how to configure now.

Installation:

Please follow the steps mentioned below to install the Mobilisten plugin in your Flutter mobile application.

Requirements:

Android

  • Minimum Android Version:  Android 5.0 (Lollipop) (API Level 21)
  • Compile SDK Version: 34 (Android 14)

iOS: The iOS SDK is compatible with iOS version 12 and above; Xcode 13.0 and above is required as the development environment.

Installation steps:

1. Add Mobilisten as a dependency within the pubspec.yaml file as shown below

Copied dependencies:
  flutter:
     sdk: flutter
  salesiq_mobilisten: ^6.3.0

2. Run flutter pub get to fetch dependencies for the project.

3. Navigate to the ios directory and run the pod install command.

4. Add the following permissions in the Info.plist file for the iOS Runner project.

5. Open the android directory in Android Studio or any IDE used for Android development. Open the project build.gradle file and add the following maven repository.

  • Add the following maven repository in the project root settings.gradle(project/android/settings.gradle) or build.gradle file(project/android/build.gradle).

For Gradle version 6.7 and below

// Add the following to your project's root build.gradle file.

allprojects {
   repositories {
      google()
      mavenCentral()
      // ...
      maven { url 'https://maven.zohodl.com' }
   }
}


For Gradle version 6.8 and above (Kotlin)

// Add the following to your settings.gradle file.

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // Add the Zoho Maven URL here
        maven { url = uri("https://maven.zohodl.com") }
    }
}


For Gradle version 6.8 and above (Groovy)

// Add the following to your settings.gradle file.

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // Add the Zoho Maven URL here
        maven { url 'https://maven.zohodl.com' }
    }
}

Now, click on Sync Now or use the Sync Project with Gradle Files option under the File menu.

6. Generate the App and Access keys for iOS to initialize Mobilisten. In the Zoho SalesIQ console, navigate to Settings → Brands → Installation → iOS. Enter the bundle ID for the application as shown in the example below and click on Generate.

Note: The App and Access keys generated for iOS are to be used in further steps.

7. Generate the App and Access keys for Android to initialize Mobilisten. In the Zoho SalesIQ console, navigate to Settings → Brands → Installation → Android. Enter the application ID for the application as shown in the below example and Click on Generate.

8: Setup the Lifecycle Callback 

Add the android:name property to the <application> tag in your AndroidManifest.xml:

Copied 
<application
    android:label="@string/app_name"
    android:icon="@drawable/ic_launcher"
    android:name="<package_name>.MyFlutterApplication">    

Copied 
import io.flutter.app.FlutterApplication;

public class MyFlutterApplication extends FlutterApplication {

        //...
 
       @Override
        public void onCreate() {
                MobilistenPlugin.registerCallbacks(this);
                super.onCreate();
        }
}    

This is essential as it enables Mobilisten to track activity's lifecycles and other listener callbacks on the app's startup to show the launcher and other important user behaviors.

Note: 

  • If you already have a custom Application class, ensure to "import com.zoho.livechat.android.MobilistenActivityLifecycleCallbacks;" and call "MobilistenActivityLifecycleCallbacks.register(this);" before invoking "super.onCreate()".

Step 9: Permissions:

  • android.permission.INTERNET: Required for network-related operations (mandatory)
  • android.permission.SCHEDULE_EXACT_ALARM: If you want your chatbot to be proactively triggered for your mobile app users after a specified duration (more than a second), add SCHEDULE_EXACT_ALARM permission in your AndroidManifest.xml. This ensures scheduling the bot trigger after the designated time. Even if your app is inactive, SalesIQ will post the trigger message as a notification for your app users. 

Note: To use the bot triggers in Android 12 & above, the SCHEDULE_EXACT_ALARM permission is mandatory.

Step 10: Proguard Configuration (Minifying App)

In some versions of the Android Gradle plugin, the R8 compiler exhibits aggressive behavior that removes some essential classes necessary for the SDK to function as expected. To handle this, we have added specific pro-guard rules within our Mobilisten SDK to preserve these crucial classes during the build process. If you have enabled ProGuard(minifyEnabled) R8, then please add the following rules in your proguard-rules.pro file in your project/android folder.

Copied 
-dontwarn kotlinx.parcelize.Parcelize

If you encounter any instances where these pro-guard rules do not suffice, kindly reach us at (support@zohosalesiq.com).

Step 11: Backup Codes

If your app has enabled backup and you have your own backup rules or some of your other dependencies have them, then all these steps below are mandatory for App data backup to Google. Since Android doesn’t support manifest merging, all backup rules must be combined into a single file, which you’ll need to reference in your app’s AndroidManifest.xml.

To complete this setup,

  1. Create XML files called merged_backup_rules.xml and merged_data_extraction_rules.xml in the res/xml/ directory. Example: android/app/src/main/res/xml.
  2. Add your rules with our Mobilisten rules to your app and verify that everything is functioning as expected.

Copied 
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <!-- Your own/other library's rules --> 
    <exclude domain="sharedpref" path="sample-data"/>
    <exclude domain="database" path="sample.db"/>

    <!-- Mobilisten rules -->
    <exclude
        domain="sharedpref"
        path="siq_encrypted_shared_preference_entries.xml" />
    <exclude
        domain="sharedpref"
        path="siq_session.xml" />
    <exclude
        domain="sharedpref"
        path="siq_permission.xml" />
    <exclude
        domain="database"
        path="siq_mobilisten.db" />
     <exclude
        domain="database"
        path="mobilisten_zoho_salesiq.db" />
</full-backup-content>

merged_data_extraction_rules.xml

Copied 
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>

    <cloud-backup>      
        <!-- Your own/other library's rules -->
        <exclude domain="sharedpref" path="sample-data"/>
        <exclude domain="database" path="sample.db"/>

        <!-- Mobilisten rules -->
        <exclude
            domain="sharedpref"
            path="siq_encrypted_shared_preference_entries.xml" />
        <exclude
            domain="sharedpref"
            path="siq_session.xml" />
        <exclude
            domain="sharedpref"
            path="siq_permission.xml" />
        <exclude
            domain="database"
            path="siq_mobilisten.db" />
        <exclude
            domain="database"
            path="mobilisten_zoho_salesiq.db" />
    </cloud-backup>

    <device-transfer>
        <!-- Your own/other library's rules -->
        <exclude domain="sharedpref" path="sample-data"/>
        <exclude domain="database" path="sample.db"/>         
    </device-transfer>
</data-extraction-rules>

Also, ensure to map it in your AndroidManifest.xml.

Copied 
android:dataExtractionRules="@xml/merged_data_extraction_rules" 
android:fullBackupContent="@xml/merged_backup_rules"'
tools:replace="android:fullBackupContent,android:dataExtractionRules,android:allowBackup"