How to use the @capacitor/core.Plugins.LocalNotifications function in @capacitor/core

To help you get started, we’ve selected a few @capacitor/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / capacitor / example / src / pages / local-notifications / local-notifications.ts View on Github external
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'
        }
      }]
github ionic-team / capacitor / example / src / pages / local-notifications / local-notifications.ts View on Github external
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
              }
            ]