Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="intent"></param>
        public override void OnReceive(Context context, Intent intent)
        {
            try
            {
                if (intent.Action != EntryIntentAction)
                {
                    System.Diagnostics.Debug.WriteLine("Action Key Not found");
                    return;
                }

                if (intent.HasExtra(NotificationActionActionId) == false)
                {
                    System.Diagnostics.Debug.WriteLine("Action Id Key Not found");
                    return;
                }

                if (intent.HasExtra(NotificationCenter.ReturnRequest) == false)
                {
                    System.Diagnostics.Debug.WriteLine("Request Key Not found");
                    return;
                }

                var actionId = intent.GetIntExtra(NotificationActionActionId, -1000);
                if (actionId == -1000)
                {
                    System.Diagnostics.Debug.WriteLine("Action Id Not found");
                    return;
                }

                var requestSerialize = intent.GetStringExtra(NotificationCenter.ReturnRequest);
                var request          = NotificationCenter.GetRequest(requestSerialize);

                var actionArgs = new NotificationActionEventArgs
                {
                    ActionId = actionId,
                    Request  = request
                };
                var notificationService = TryGetDefaultDroidNotificationService();
                notificationService.OnNotificationActionTapped(actionArgs);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
 /// <inheritdoc />
 public void OnNotificationActionTapped(NotificationActionEventArgs e)
 {
     NotificationActionTapped?.Invoke(e);
 }