Local Notifications with Multiple Actions / Buttons


#1

I am trying to figure out how to add multiple action buttons to local notifications. I have read the ngCordova local notification docs but it does not seem to be available. I am looking for the equivalent of multiple ion-option-buttons on an ion-item but for a lock screen notification. I think ios calls these interactive local notifications and notification actions.

As an example left swiping on GMail notification on the ios lock screen shows the cancel “X” along with buttons for “Reply” and “Archive”.

Thanks in advance.


Cordova Plugin not using ionic-native
#2

Any response or update on this? Game changer when notifications are actionable.


#3

No luck here yet. Total bummer.


#4

I implemented them here: https://github.com/elizabethrego/cordova-plugin-local-notifications

These changes have been merged into a branch of Sebastián Katzer’s local notification plugin for the next release, but you can use the repo linked above for now.


#5

You are awesome Elli! Thanks so much!


#6

No problem :slight_smile: Sorry I didn’t see this thread earlier, I’ve had them done for a few months.


#7

I “hearted” both of your responses because its that awesome! Thank you!


#8

Does this only support iOS?


#9

Nope, both Android and iOS are supported!


#10

how to use in
ionic v 3.3.0?
i get this error


[12:14:07]  build prod started ... 
[12:14:07]  clean started ... 
[12:14:07]  clean finished in 1 ms 
[12:14:07]  copy started ... 
[12:14:07]  ngc started ... 
[12:14:11]  typescript: src/pages/home/home.ts, line: 106 
            Argument of type '{ id: number; title: string; text: string; at: number; actions: { identifier: string; 
            title: stri...' is not assignable to parameter of type 'ILocalNotification | ILocalNotification[]'. Object 
            literal may only specify known properties, and 'actions' does not exist in type 'ILocalNotification | 
            ILocalNotification[]'. 

     L105:  at: new Date().getTime(),
     L106:  actions: [actions[0], actions[1]],
     L107:  category: 'SIGN_IN_TO_CLASS'

[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of date.
Error: Failed to transpile TypeScript

#11

Hi Elli,
Does this plugin work with latest version of ionic, if not can you please look into it. It’ll be awesome. Thanks in advance.


#12

Hi Vpotluri,

The plug-in works with the latest ionic version but the native wrapper is outdated. You can implement the Cordova way as explained here: Cordova Plugin not using ionic-native


#13

Hi Nathan,
Thank you for the response. Do I need to add any other plugin because this seems not working. I tried below, I see notification but I don’t see action buttons in it. Thanks in advance.

(cordova).plugins.notification.local.schedule({
id: notificationId,
title: description,
at: notifyDate,
actions: [actions[0], actions[1]],
every: frequency
});


#14

Someone has tried local notifications with ios11.1 and 0.8.5 plugin version?

I have tried to send one notification it doesnt displayed. On android works fine


#15

I also tried this one with android 7 and the notification is pushed but can’t see any buttons :frowning:
I’m using Ionic V3