Esempio n. 1
0
        protected virtual NotificationCompat.Action CreateAction(Notification notification, NotificationAction action)
        {
            var pendingIntent = this.CreateActionIntent(notification, action);
            var iconId        = this.context.GetResourceIdByName(action.Identifier);
            var nativeAction  = new NotificationCompat.Action.Builder(iconId, action.Title, pendingIntent).Build();

            return(nativeAction);
        }
Esempio n. 2
0
        protected virtual NotificationCompat.Action CreateTextReply(Notification notification, NotificationAction action)
        {
            var pendingIntent = this.CreateActionIntent(notification, action);
            var input         = new RemoteInput.Builder("Result")
                                .SetLabel(action.Title)
                                .Build();

            var iconId       = this.context.GetResourceIdByName(action.Identifier);
            var nativeAction = new NotificationCompat.Action.Builder(iconId, action.Title, pendingIntent)
                               .SetAllowGeneratedReplies(true)
                               .AddRemoteInput(input)
                               .Build();

            return(nativeAction);
        }
Esempio n. 3
0
        protected virtual PendingIntent CreateActionIntent(Notification notification, NotificationAction action)
        {
            var intent  = this.context.CreateIntent <NotificationBroadcastReceiver>(NotificationBroadcastReceiver.IntentAction);
            var content = this.serializer.Serialize(notification);

            intent
            .PutExtra("Notification", content)
            .PutExtra("Action", action.Identifier);

            counter++;
            var pendingIntent = PendingIntent.GetBroadcast(
                this.context.AppContext,
                counter,
                intent,
                PendingIntentFlags.UpdateCurrent
                );

            return(pendingIntent);
        }