ionic in app notification code example
Example: how to set notification in ionic app
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
constructor(private localNotifications: LocalNotifications) { }
...
this.localNotifications.schedule({
id: 1,
text: 'Single ILocalNotification',
sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
data: { secret: key }
});
this.localNotifications.schedule([{
id: 1,
text: 'Multi ILocalNotification 1',
sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
data: { secret:key }
},{
id: 2,
title: 'Local ILocalNotification Example',
text: 'Multi ILocalNotification 2',
icon: 'http://example.com/icon.png'
}]);
this.localNotifications.schedule({
text: 'Delayed ILocalNotification',
trigger: {at: new Date(new Date().getTime() + 3600)},
led: 'FF0000',
sound: null
});