emekalites / react-native-alarm-notification

schedule alarm and local notification in react-native
https://www.npmjs.com/package/react-native-alarm-notification
MIT License
225 stars 95 forks source link

Remove or modify notification actions buttons #54

Closed lklima closed 4 years ago

lklima commented 4 years ago

First congratulations on the excellent work, it would be interesting to remove or modify the action buttons of the notification. I use this lib to notify a new delivery.

akinmac002 commented 4 years ago

I have the same problem. @emekalites

ZiyaDogramaci commented 4 years ago

You can remove buttons by commenting out the following lines on the file AlarmUtil.java => sendNotification

Intent dismissIntent = new Intent(mContext, AlarmReceiver.class); dismissIntent.setAction(NOTIFICATION_ACTION_DISMISS); dismissIntent.putExtra("AlarmId", alarm.getId()); PendingIntent pendingDismiss = PendingIntent.getBroadcast(mContext, notificationID, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Action dismissAction = new NotificationCompat.Action(android.R.drawable.ic_lock_idle_alarm, "DISMISS", pendingDismiss); mBuilder.addAction(dismissAction);

Intent snoozeIntent = new Intent(mContext, AlarmReceiver.class); snoozeIntent.setAction(NOTIFICATION_ACTION_SNOOZE); snoozeIntent.putExtra("SnoozeAlarmId", alarm.getId()); PendingIntent pendingSnooze = PendingIntent.getBroadcast(mContext, notificationID, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Action snoozeAction = new NotificationCompat.Action(R.drawable.ic_snooze, "SNOOZE", pendingSnooze); mBuilder.addAction(snoozeAction);

emekalites commented 4 years ago

The buttons will be hidden by default. But if you need them you can pass "has_button: true"

stale[bot] commented 4 years ago

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

stale[bot] commented 4 years ago

Closed due to inactivity. Holler if this is a mistake, and we'll re-open it.

MrTuyennn commented 4 years ago

The buttons will be hidden by default. But if you need them you can pass "has_button: true"

it's not working

MrTuyennn commented 4 years ago

The buttons will be hidden by default. But if you need them you can pass "has_button: true"

  title: 'my title',
  message: 'my message,
  schedule_type: 'repeat',
  repeat_interval: 'daily,
  auto_cancel: true,
  has_button: true,

=> has_button is not working

pankajdreamsoft commented 3 years ago

Any solution for this ... How can i add one more button in action buttons ?