public override void OnTokenRefresh() { var refreshedToken = FirebaseInstanceId.Instance.Token; Log.Debug(TAG, "Refreshed token: " + refreshedToken); Apptentive.SetPushNotificationIntegration(Apptentive.PushProviderApptentive, refreshedToken); }
public override void OnCreate() { base.OnCreate(); var configuration = new ApptentiveConfiguration("Your Apptentive Key", "Your Apptentive Signature"); configuration.SetLogLevel(ApptentiveLog.Level.Verbose); configuration.SetShouldSanitizeLogMessages(false); Apptentive.Register(this, configuration); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); Button button = FindViewById <Button>(Resource.Id.leave_feedback); button.Click += delegate { Apptentive.ShowMessageCenter(this); }; }
private void LoginUser() { var jwt = FindViewById <TextView>(Resource.Id.jwtField).Text; Apptentive.Login(jwt, (success, error) => { if (success) { Toast.MakeText(this, "Logged In", ToastLength.Long).Show(); } else { Toast.MakeText(this, "Error logging in: " + error, ToastLength.Long).Show(); } }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.CustomData); var customDataKeyEditText = FindViewById <EditText>(Resource.Id.userDataKeyEditText); var customDataValueEditText = FindViewById <EditText>(Resource.Id.userDataValueEditText); FindViewById <Button>(Resource.Id.addUserDataButton).Click += delegate { Apptentive.AddCustomPersonData(customDataKeyEditText.Text, customDataValueEditText.Text); }; var deviceDataKeyEditText = FindViewById <EditText>(Resource.Id.deviceDataKeyEditText); var deviceDataValueEditText = FindViewById <EditText>(Resource.Id.deviceDataValueEditText); FindViewById <Button>(Resource.Id.addUserDataButton).Click += delegate { Apptentive.AddCustomPersonData(deviceDataKeyEditText.Text, deviceDataValueEditText.Text); }; }
/** * Called when message is received. */ public override void OnMessageReceived(RemoteMessage message) { LogPushBundle(message); var data = message.Data; String title = null; String body = null; if (Apptentive.IsApptentivePushNotification(data)) { Log.Error(TAG, "Apptentive push."); title = Apptentive.GetTitleFromApptentivePush(data); body = Apptentive.GetBodyFromApptentivePush(data); Apptentive.BuildPendingIntentFromPushNotification((pendingIntent) => { // This push is from Apptentive, but not for the active conversation, so we can't safely display it. if (pendingIntent == null) { Log.Error(TAG, "Push notification was not for the active conversation. Doing nothing."); return; } ShowNotification(pendingIntent, title, body); }, data); } else { Log.Error(TAG, "Non-Apptentive push."); Intent intent = new Intent(this, typeof(MainActivity)); intent.AddFlags(ActivityFlags.ClearTop); var pushNotification = message.GetNotification(); if (pushNotification != null) { title = pushNotification.Title; body = pushNotification.Body; } var pendingIntent = PendingIntent.GetActivity(this, 0 /* Request code */, intent, PendingIntentFlags.OneShot); ShowNotification(pendingIntent, title, body); } }
protected override void OnStop() { base.OnStop(); Apptentive.OnStop(this); }
private void LogoutUser() { Apptentive.Logout(); Toast.MakeText(this, "Logged Out", ToastLength.Long).Show(); // FIXME: implement logout }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Controls var eventNameEditText = FindViewById <EditText>(Resource.Id.eventEditText); var messageCenterButton = FindViewById <Button>(Resource.Id.messageCenterButton); messageCenterButton.Click += delegate { Apptentive.ShowMessageCenter(this, (shown) => Console.WriteLine("Message Center shown: " + shown)); }; var engageButton = FindViewById <Button>(Resource.Id.engageButton); engageButton.Click += delegate { var eventName = eventNameEditText.Text; Apptentive.Engage(this, eventName, (engaged) => Console.WriteLine("Interaction engaged: " + engaged)); }; var canShowInteractionButton = FindViewById <Button>(Resource.Id.canShowInteractionButton); canShowInteractionButton.Click += delegate { var eventName = eventNameEditText.Text; Apptentive.QueryCanShowInteraction(eventName, (canShowInteraction) => Toast.MakeText(this, canShowInteraction ? "Yes" : "No", ToastLength.Long).Show()); }; var userDataButton = FindViewById <Button>(Resource.Id.userDataButton); userDataButton.Click += delegate { var intent = new Intent(this, typeof(UserDataActivity)); StartActivity(intent); }; var customDataButton = FindViewById <Button>(Resource.Id.customDataButton); customDataButton.Click += delegate { var intent = new Intent(this, typeof(CustomDataActivity)); StartActivity(intent); }; var authenticationButton = FindViewById <Button>(Resource.Id.authenticationButton); authenticationButton.Click += delegate { var intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); }; unreadMessagesTextView = FindViewById <TextView>(Resource.Id.unreadMessagesText); UpdateUnreadMessagesCount(); Apptentive.AddUnreadMessagesListener(this); }