public void TrackECommerce(decimal fullPrice, string orderId, string currency) { var bundle = new Android.OS.Bundle(); bundle.PutDouble(FirebaseAnalytics.Param.Price, (double)fullPrice); bundle.PutString(FirebaseAnalytics.Param.TransactionId, orderId); bundle.PutString(FirebaseAnalytics.Param.Currency, currency); _fAnalytics.LogEvent(FirebaseAnalytics.Event.EcommercePurchase, bundle); }
public void TrackEvent(string category, string action, string label, object model) { var bundle = new Android.OS.Bundle(); bundle.PutString(nameof(action), action); bundle.PutString(nameof(label), label ?? ""); bundle.PutString(nameof(model), model == null ? "" : JsonConvert.SerializeObject(model)); _fAnalytics.LogEvent(category, bundle); }
/// <Docs>Bundle in which to place your saved state.</Docs> /// <summary> /// Raises the save instance state event and puts the ViewModel back into the container. /// </summary> /// <param name="outState">Out state.</param> protected override void OnSaveInstanceState(Android.OS.Bundle outState) { var guid = ViewModelContainer.Push(this.Model); outState.PutString(ModelId, guid.ToString()); base.OnSaveInstanceState(outState); }
private void PullUserProfileAsync() { var parameters = new Android.OS.Bundle(); parameters.PutString("fields", "id,name,email,gender"); GraphRequest request = new GraphRequest(AccessToken.CurrentAccessToken, "me", parameters, HttpMethod.Get, this); request.ExecuteAsync(); }
public void TrackException(string message, bool isFatal) { var bundle = new Android.OS.Bundle(); bundle.PutString(nameof(message), message); bundle.PutBoolean(nameof(isFatal), isFatal); _fAnalytics.LogEvent("app_exception", bundle); }
public void OnSuccess(Java.Lang.Object result) { if (result is LoginResult loginResult) { var request = GraphRequest.NewMeRequest(loginResult.AccessToken, this); var bundle = new Android.OS.Bundle(); bundle.PutString("fields", "id, first_name, email, last_name, picture.width(500).height(500)"); request.Parameters = bundle; request.ExecuteAsync(); } }
public override void OnSaveInstanceState(Android.OS.Bundle outState) { this.ExecuteMethod("OnSaveInstanceState", delegate() { base.OnSaveInstanceState(outState); if (this.RouteData != null) { outState.PutString(AndroidAssumptions.ROUTE_KEY, JsonConvert.SerializeObject(this.RouteData)); } }); }
public void TrackScreen(string screenName) { if (screenName.Length >= 36) { screenName = screenName.Substring(screenName.Length - 35); } var bundle = new Android.OS.Bundle(); bundle.PutString(FirebaseAnalytics.Param.ItemId, screenName); _fAnalytics.LogEvent(FirebaseAnalytics.Event.ViewItem, bundle); }
/// <summary> /// Notifica Android /// </summary> /// <param name="title">Titolo</param> /// <param name="message">Messaggio</param> /// <param name="launchArg">Argomento passato all'applicazione al click della notifica</param> public void SendNotification(string title, string message, string launchArg = null) { const int notificationId = 0; Context context = (Context ?? Android.App.Application.Context); NotificationCompat.BigTextStyle textStyle = new NotificationCompat.BigTextStyle(); textStyle.BigText(message); NotificationCompat.Builder builder = new NotificationCompat.Builder(context, MainActivity.Instance.ChannelID) .SetContentTitle(title) .SetContentText(message) .SetStyle(textStyle); if (!string.IsNullOrEmpty(launchArg)) { var bundle = new Android.OS.Bundle(); bundle.PutString("launch", launchArg); if (NotificationIntent != null) { NotificationIntent.PutExtra("launch", launchArg); PendingIntent pendingIntent = PendingIntent.GetActivity(context, 0, NotificationIntent, PendingIntentFlags.OneShot); builder.SetContentIntent(pendingIntent); } else { builder.SetExtras(bundle); } } if (Android.OS.Build.VERSION.SdkInt > Android.OS.BuildVersionCodes.LollipopMr1) { builder.SetSmallIcon(Resource.Drawable.ic_notification); builder.SetVibrate(new long[] { 100, 200, 300 }); } else { builder.SetSmallIcon(Resource.Drawable.ic_notification_white); } // Build the notification: Notification notification = builder.Build(); // Get the notification manager: NotificationManager notificationManager = context.GetSystemService(Context.NotificationService) as NotificationManager; // Publish the notification: notificationManager.Notify(notificationId, notification); }
private void SaveNativeCredential(NativeCredential nativeCredential, string ssoGroupKey) { var serializedCredential = nativeCredential.Serialize(); // If there exists a credential, delete before writing new credential var existingCredential = FindCredential(nativeCredential.UserID, ssoGroupKey); if (existingCredential != null) { accountManager.RemoveAccountExplicitly(new Account(existingCredential.UserID, ssoGroupKey)); } // Add new credential Account account = new Account(nativeCredential.UserID, ssoGroupKey); Android.OS.Bundle bundle = new Android.OS.Bundle(); bundle.PutString(Constants.STR_CREDENTIAL, serializedCredential); accountManager.AddAccountExplicitly(account, "", bundle); }
override public bool OnControlRequest(Intent intent, Android.Support.V7.Media.MediaRouter.ControlRequestCallback callback) { Android.Util.Log.Debug(TAG, mRouteId + ": Received control request " + intent); if (intent.Action.Equals(MediaControlIntent.ActionPlay) && intent.HasCategory(MediaControlIntent.CategoryRemotePlayback) && intent.Data != null) { mOutterClass.mPlaybackCount += 1; // TODO: Handle queue ids. var uri = intent.Data; long contentPositionMillis = intent.GetLongExtra( MediaControlIntent.ExtraItemContentPosition, 0); var metadata = intent.GetBundleExtra(MediaControlIntent.ExtraItemMetadata); var headers = intent.GetBundleExtra( MediaControlIntent.ExtraItemHttpHeaders); Android.Util.Log.Debug(TAG, mRouteId + ": Received play request, uri=" + uri + ", contentPositionMillis=" + contentPositionMillis + ", metadata=" + metadata + ", headers=" + headers); if (uri.ToString().Contains("hats")) { // Simulate generating an error whenever the uri contains the word 'hats'. Android.Widget.Toast.MakeText(mOutterClass.Context, "Route rejected play request: uri=" + uri + ", no hats allowed!", Android.Widget.ToastLength.Long).Show(); if (callback != null) { callback.OnError("Simulated error. No hats allowed!", null); } } else { Android.Widget.Toast.MakeText(mOutterClass.Context, "Route received play request: uri=" + uri, Android.Widget.ToastLength.Long).Show(); string streamId = mOutterClass.GenerateStreamId(); if (callback != null) { MediaItemStatus status = new MediaItemStatus.Builder( MediaItemStatus.PlaybackStatePlaying) .SetContentPosition(contentPositionMillis) .Build(); var result = new Android.OS.Bundle(); result.PutString(MediaControlIntent.ExtraItemId, streamId); result.PutString(MediaControlIntent.ExtraItemStatus, status.AsBundle().ToString()); callback.OnResult(result); } } return(true); } if (intent.Action.Equals(ACTION_GET_STATISTICS) && intent.HasCategory(CATEGORY_SAMPLE_ROUTE)) { var data = new Android.OS.Bundle(); data.PutInt(DATA_PLAYBACK_COUNT, mOutterClass.mPlaybackCount); if (callback != null) { callback.OnResult(data); } return(true); } return(false); }