cordova-plugin-local-notifications icon indicating copy to clipboard operation
cordova-plugin-local-notifications copied to clipboard

the image did not show with 'attachments'

Open Epameinondas-Theodoropoulos opened this issue 4 years ago • 2 comments

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue.

Your Environment

Ionic:

Ionic CLI : 5.4.13 (C:\Users\EPAMEINONDAS\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.11.10 @angular-devkit/build-angular : 0.801.3 @angular-devkit/schematics : 8.1.3 @angular/cli : 8.1.3 @ionic/angular-toolkit : 2.2.0

Capacitor:

Capacitor CLI : 1.4.0 @capacitor/core : 1.4.0

Utility:

cordova-res : not installed native-run : 1.0.0

System:

NodeJS : v11.5.0 (C:\Program Files\nodejs\node.exe) npm : 6.4.1 OS : Windows 10

Expected Behavior

I want to show a picture with the local notifications

Actual Behavior

The picture did not appear

Steps to Reproduce

  1. ... Just create an Ionic project and install the plugin
  2. ...
         npm install cordova-plugin-local-notification
         npm install @ionic-native/local-notifications
         ionic cap sync
  1. ... this is the code that does not work
      this.localNotifications.schedule({
        id: 1,
        title: 'My scheduleNotofication',
        text: 'Thats pretty easy scheduleNotofication...',
        data: {mydata: 'My hidden message this is 1'},
        foreground: true, // would be visible even if the app is open
        vibrate: true,
        attachments: ["file://img/coffee.jpg"], 
        led: '#FF00FF',
        trigger: { in: 8, unit: ELocalNotificationTriggerUnit.SECOND}
    });

i have tried with these attachments paths and none have worked: ../assets/img/coffee.jpg file://coffee.jpg D:/Hard Disk/Apps/AthenLairsApp-ALA/android/app/src/main/assets/public/assets/img/coffee.jpg

BUT!!! It works with URL, This showed the image attachments: ["https://cdn.craftbeer.com/wp-content/uploads/coffee2_hero.jpg"]

Any update on this issue. Need to understand where to place the image asset

rajasekarsp avatar Sep 01 '21 15:09 rajasekarsp

You can use format just like this: attachments: ['file://assets/myicon.png'], "assets" is the directory in your Ionic project.

lon2347 avatar Dec 22 '22 08:12 lon2347