clevertap_plugin 1.2.2 copy "clevertap_plugin: ^1.2.2" to clipboard
clevertap_plugin: ^1.2.2 copied to clipboard

outdated

The CleverTap Flutter SDK for Mobile Customer Engagement,Analytics and Retention solutions.

CleverTap Flutter SDK #

pub package

πŸ‘‹ Introduction #

The CleverTap Flutter SDK for Mobile Customer Engagement and Analytics solutions.

For more information check out our website and documentation.

To get started, sign up here

πŸš€ Installation and Quick Start #

  • To add the CleverTap Flutter SDK to your project, edit your project's pubspec.yaml file:
dependencies:
clevertap_plugin: 1.2.2
  • Run flutter packages get to install the SDK

  • Now, in your Dart code, you can use:

import 'package:clevertap_plugin/clevertap_plugin.dart';

πŸ‘¨β€πŸ’» Android #

Add the following to your dependencies section in project/build.gradle

    dependencies {
            classpath 'com.android.tools.build:gradle:4.1.1'
            classpath 'com.google.gms:google-services:4.3.8' //<--- Mandatory for using Firebase Messaging, skip if not using FCM
        }

Add the following to your dependencies section in app/build.gradle

        implementation 'com.google.firebase:firebase-messaging:20.2.4'
        implementation 'androidx.core:core:1.3.0'
        implementation 'androidx.fragment:fragment:1.1.0'
        
        //MANDATORY for App Inbox
        implementation 'androidx.appcompat:appcompat:1.2.0'
        implementation 'androidx.recyclerview:recyclerview:1.1.0'
        implementation 'androidx.viewpager:viewpager:1.0.0'
        implementation 'com.google.android.material:material:1.2.1'
        implementation 'com.github.bumptech.glide:glide:4.11.0'
        
        //For CleverTap Android SDK v3.6.4 and above add the following -
        implementation 'com.android.installreferrer:installreferrer:2.1'
        
        //Optional ExoPlayer Libraries for Audio/Video Inbox Messages. Audio/Video messages will be dropped without these dependencies
        implementation 'com.google.android.exoplayer:exoplayer:2.11.5'
        implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.5'
        implementation 'com.google.android.exoplayer:exoplayer-ui:2.11.5'

At the end of the app/build.gradle file add the following

    apply plugin: 'com.google.gms.google-services' //skip if not using FCM

In your app's Android Application class add the following code.

    public class MyApplication extends FlutterApplication {
        @java.lang.Override
        public void onCreate() {
            ActivityLifecycleCallback.register(this); //<--- Add this before super.onCreate()
            super.onCreate();
        }
    }

If you do not have an Application class, add this to your AndroidManifest.xml

    <application
        android:label="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:name="com.clevertap.android.sdk.Application"> 

Add the following permissions which are needed by the CleverTap SDK

    <!-- Required to allow the app to send events and user profile information -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <!-- Recommended so that CleverTap knows when to attempt a network call -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Add your CleverTap Account ID and Token to your AndroidManifest.xml, within the tags.

    <meta-data
        android:name="CLEVERTAP_ACCOUNT_ID"
        android:value="Your CleverTap Account ID"/>
    <meta-data
        android:name="CLEVERTAP_TOKEN"
        android:value="Your CleverTap Account Token"/>
    <!-- IMPORTANT: To force use Google AD ID to uniquely identify  users, use the following meta tag. GDPR mandates that if you are using this tag, there is prominent disclousure to your end customer in their application. Read more about GDPR here - https://clevertap.com/blog/in-preparation-of-gdpr-compliance/ -->
    <meta-data
        android:name="CLEVERTAP_USE_GOOGLE_AD_ID"
        android:value="1"/> 

To use Push Notifications out of the box using CleverTap, add the following entries to you AndroidManifest.xml

<application>
         ....
         ....
        <service android:name="com.clevertap.android.sdk.pushnotification.fcm.FcmMessageListenerService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

 </application>

If you're upgrading to CleverTap Flutter SDK v1.2.0 and above, please find the CHANGELOG related to CleverTap Android SDK here.

πŸ‘©β€πŸ’» iOS #

After installation, you will need to integrate CleverTap SDK into your app.

  • Follow the integration instructions starting with Step 2 here.

  • Initialize CleverTap SDK by adding the following code snippet:

    • Import the CleverTap header in your AppDelegate file
    Objective-C
    #import "CleverTap.h"
    #import "CleverTapPlugin.h"
    
    Swift
    import CleverTapSDK
    import clevertap_plugin
    
    • In your didFinishLaunchingWithOptions: method notify the CleverTap Flutter SDK of application launch
    Objective-C
    [CleverTap autoIntegrate]; // integrate CleverTap SDK using the autoIntegrate option
    [[CleverTapPlugin sharedInstance] applicationDidLaunchWithOptions:launchOptions];
    
    Swift
    CleverTap.autoIntegrate() // integrate CleverTap SDK using the autoIntegrate option
    CleverTapPlugin.sharedInstance()?.applicationDidLaunch(options: launchOptions)
    

πŸ“‘ For more #

πŸ†• Changelog #

Refer to the CleverTap Flutter SDK Change Log.

❓Questions #

If you have questions or concerns, you can reach out to the CleverTap support team from the CleverTap Dashboard.

29
likes
0
pub points
97%
popularity

Publisher

verified publisherclevertap.com

The CleverTap Flutter SDK for Mobile Customer Engagement,Analytics and Retention solutions.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on clevertap_plugin