Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async scheduleNowWithIcon() {
this.notifs = await Plugins.LocalNotifications.schedule({
notifications: [{
title: 'Get 10% off!',
body: 'Swipe now to learn more',
// Android-only: set a custom statusbar icon
smallIcon: "res://ic_stat_icon_sample",
// Get random id to test cancel
id: Math.floor(Math.random()*10),
sound: 'beep.aiff',
attachments: [
{ id: 'face', url: 'res://public/assets/ionitron.png' }
],
actionTypeId: 'OPEN_PRODUCT',
extra: {
productId: 'PRODUCT-1'
}
}]
async init() {
await Plugins.LocalNotifications.requestPermissions();
try {
Plugins.LocalNotifications.registerActionTypes({
types: [
{
id: 'OPEN_PRODUCT',
actions: [
{
id: 'view',
title: 'Product'
}, {
id: 'remove', title: 'Remove', destructive: true
},
{
id: 'response',
title: 'Response',
input: true
}
]