首页 > 解决方案 > attachment propriety not working in ionic local notification plugin

问题描述

We are working on hybrid mobile application (ionic 3 and angular 4). We are trying attachment with local-notification.

https://ionicframework.com/docs/v3/native/local-notifications/

we tried like this

this.localNotifications.schedule({
      id: 1,
      title: 'Title',
      text: 'Dec',
      attachments: ['https://atlas-content-cdn.pixelsquid.com/stock-images/golden-soccer-ball-3yLR9z1-600.jpg'],
      foreground: true,
      vibrate: true,
      actions: [
        { id: 'yes', title: 'Yes' },
        { id: 'no',  title: 'No' }
    ]
    });

unable to get attachment in notification .Let us know what we missed .

标签: angularcordovaionic-frameworkionic-nativelocalnotification

解决方案


传递小图像

uri='https://atlas-content-cdn.pixelsquid.com/stock-images/golden-soccer-ball-3yLR9z1-600.jpg'

this.localNotifications.schedule({
      id: 1,
      title: 'Title',
      text: 'Dec',
      attachments: [uri],
      foreground: true,
      vibrate: true,
      actions: [
        { id: 'yes', title: 'Yes' },
        { id: 'no',  title: 'No' }
    ]
    });

推荐阅读