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); }
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); }
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); }