Exemplo n.º 1
0
 // Init Inbox
 private void inbox()
 {
     //Initialize the inbox and wait for callbacks on overridden methods
     cleverTapAPI.CTNotificationInboxListener = this;
     cleverTapAPI.SetInboxMessageButtonListener(this);
     cleverTapAPI.InitializeInbox();
 }
Exemplo n.º 2
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);
        }