Esempio n. 1
0
        // Init Notification Configuration
        private void notification()
        {
            //Create Channel

            //CleverTapAPI.CreateNotificationChannel(Android.App.Application.Context, "YourChannelId", "Your Channel Name", "Your Channel Description", 5, true);
            CleverTapAPI.CreateNotificationChannel(Android.App.Application.Context, "BRTesting", "BRTesting", "BRTesting", 5, true);
            //Create Channel Group
            CleverTapAPI.CreateNotificationChannelGroup(Android.App.Application.Context, "YourGroupId", "Your Group Name");

            PushTokenAsync();
        }
        public override void OnMessageReceived(RemoteMessage message)
        {
            Log.Debug(TAG, "From: " + message.From);

            //Step 1: parsing message to bundle
            Bundle bundle = new Bundle();

            foreach (KeyValuePair <string, string> entry in message.Data)
            {
                bundle.PutString(entry.Key, entry.Value);
            }
            Log.Debug(TAG, "Notification Message Body: " + bundle);

            //Step 2: Creating Notification
            CleverTapAPI.CreateNotification(this, bundle);

            //Step 3: Raising push impression
            CleverTapAPI.GetDefaultInstance(Android.App.Application.Context).PushNotificationViewedEvent(bundle);
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CleverTapAPI.SetDebugLevel(CleverTapAPI.LogLevel.Debug);
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;
            //Intialise CT SDK
            cleverTapAPI = CleverTapAPI.GetDefaultInstance(Android.App.Application.Context);
            String token = FirebaseInstanceId.Instance.Token;


            cleverTapAPI.PushFcmRegistrationId(token, true);
            Log.Debug("TOken", "token Sent" + token);
            // Add custom implementation, as needed.
            //Push Event
            cleverTapAPI.PushEvent("Product View Via Xamarin");
            ICTInboxListener cTNotificationInboxListener = cleverTapAPI.CTNotificationInboxListener;

            cleverTapAPI.SetDisplayUnitListener(this);
            ICTExperimentsListener cTExperimentsListener = cleverTapAPI.CTExperimentsListener;

            //Initialize the inbox and wait for callbacks on overridden methods
            cleverTapAPI.InitializeInbox();
            //Push Profile

            IDictionary <string, Java.Lang.Object> profileData = new Dictionary <string, Java.Lang.Object>();

            profileData.Add("Name", "Atul");             // String
            profileData.Add("Identity", 97839492);       // String or number
            profileData.Add("Email", "*****@*****.**"); // Email address of the user
            profileData.Add("Phone", "7012801820919");   // Phone (with the country code, starting with +)
            profileData.Add("Gender", "M");              // Can be either M or F
            profileData.Add("DOB", new Date());          // Date of Birth. Set the Date object to the appropriate value first - requires java.util


            cleverTapAPI.PushProfile(profileData);


            //onUserLogin Profile

            IDictionary <string, Java.Lang.Object> profile = new Dictionary <string, Java.Lang.Object>();

            profile.Add("Name", "Atul");             // String
            profile.Add("Identity", 97839492);       // String or number
            profile.Add("Email", "*****@*****.**"); // Email address of the user
            profile.Add("Phone", "7012801820919");   // Phone (with the country code, starting with +)
            profile.Add("Gender", "M");              // Can be either M or F
            profile.Add("DOB", new Date());          // Date of Birth. Set the Date object to the appropriate value first - requires java.util


            cleverTapAPI.OnUserLogin(profile);

            //Create Channel
            CleverTapAPI.CreateNotificationChannel(Android.App.Application.Context, "1", "dkchannel", "dkchannel", 3, true);

            //Create Channel Group
            CleverTapAPI.CreateNotificationChannelGroup(Android.App.Application.Context, "1", "dkchannel");


            //Create Notification
            Bundle Extras = new Bundle();

            CleverTapAPI.CreateNotification(Android.App.Application.Context, Extras);

            //Push Impression
            Bundle SampleExtras = new Bundle();

            cleverTapAPI.PushNotificationViewedEvent(SampleExtras);

            //Record Charged
            IDictionary <string, Java.Lang.Object> chargedDetails = new Dictionary <string, Java.Lang.Object>();

            chargedDetails.Add("Total Amount", 400);

            IDictionary <string, Java.Lang.Object> item1 = new Dictionary <string, Java.Lang.Object>();

            item1.Add("Product Name", "Harry Potter");
            item1.Add("ProductID", "4756");
            item1.Add("Price", 300);

            IDictionary <string, Java.Lang.Object> item2 = new Dictionary <string, Java.Lang.Object>();

            item2.Add("Product Name", "Harry Potter 2");
            item2.Add("ProductID", "4776");
            item2.Add("Price", 100);

            List <IDictionary <string, Java.Lang.Object> > items = new List <IDictionary <string, Java.Lang.Object> >();

            items.Add(item1);
            items.Add(item2);

            cleverTapAPI.PushChargedEvent(chargedDetails, items);
        }
Esempio n. 4
0
        //*****************           CLEVERTAP METHODS   ****************************

        // Init CleverTap
        private void initClevertap()
        {
            CleverTapAPI.SetDebugLevel(CleverTapAPI.LogLevel.Debug);
            cleverTapAPI = CleverTapAPI.GetDefaultInstance(Android.App.Application.Context);
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            //Intialise CT SDK
            CleverTapAPI cleverTapAPI = CleverTapAPI.GetDefaultInstance(Android.App.Application.Context);


            //Push Event
            cleverTapAPI.PushEvent("Product View Via Xamarin");

            //Push Profile

            IDictionary <string, Java.Lang.Object> profileData = new Dictionary <string, Java.Lang.Object>();

            profileData.Add("Name", "Jack Montana");    // String
            profileData.Add("Identity", 61026032);      // String or number
            profileData.Add("Email", "*****@*****.**"); // Email address of the user
            profileData.Add("Phone", "+14155551234");   // Phone (with the country code, starting with +)
            profileData.Add("Gender", "M");             // Can be either M or F
            profileData.Add("DOB", new Date());         // Date of Birth. Set the Date object to the appropriate value first - requires java.util


            cleverTapAPI.PushProfile(profileData);


            //onUserLogin Profile

            IDictionary <string, Java.Lang.Object> profile = new Dictionary <string, Java.Lang.Object>();

            profile.Add("Name", "Jack Montana");    // String
            profile.Add("Identity", 61026032);      // String or number
            profile.Add("Email", "*****@*****.**"); // Email address of the user
            profile.Add("Phone", "+14155551234");   // Phone (with the country code, starting with +)
            profile.Add("Gender", "M");             // Can be either M or F
            profile.Add("DOB", new Date());         // Date of Birth. Set the Date object to the appropriate value first - requires java.util


            cleverTapAPI.OnUserLogin(profile);

            //Create Channel
            CleverTapAPI.CreateNotificationChannel(Android.App.Application.Context, "1", "dkchannel", "dkchannel", 3, true);

            //Create Channel Group
            CleverTapAPI.CreateNotificationChannelGroup(Android.App.Application.Context, "1", "dkchannel");


            //Create Notification
            Bundle Extras = new Bundle();

            CleverTapAPI.CreateNotification(Android.App.Application.Context, Extras);

            //Push Impression
            Bundle SampleExtras = new Bundle();

            cleverTapAPI.PushNotificationViewedEvent(SampleExtras);

            //Record Charged
            IDictionary <string, Java.Lang.Object> chargedDetails = new Dictionary <string, Java.Lang.Object>();

            chargedDetails.Add("Total Amount", 400);

            IDictionary <string, Java.Lang.Object> item1 = new Dictionary <string, Java.Lang.Object>();

            item1.Add("Product Name", "Harry Potter");
            item1.Add("ProductID", "4756");
            item1.Add("Price", 300);

            IDictionary <string, Java.Lang.Object> item2 = new Dictionary <string, Java.Lang.Object>();

            item2.Add("Product Name", "Harry Potter 2");
            item2.Add("ProductID", "4776");
            item2.Add("Price", 100);

            List <IDictionary <string, Java.Lang.Object> > items = new List <IDictionary <string, Java.Lang.Object> >();

            items.Add(item1);
            items.Add(item2);

            cleverTapAPI.PushChargedEvent(chargedDetails, items);
        }
 void SendRegistrationToServer(string token)
 {
     CleverTapAPI.TokenRefresh(this, token, PushConstantsPushType.Fcm);
     // Add custom implementation, as needed.
 }