[Solved] Local Notification's sound not working


#1

Hello,

I am using Local Notification plugin and using Native Ringtone to set sound. But the content:// uri is not working with Local Notification.

this.localNotifications.schedule({
      text: 'Delayed ILocalNotification',
      data: { id: 1 },
      at: new Date(new Date().getTime() + 5000),
      led: 'FF0000',
      sound: 'content://media/internal/audio/media/19'
    });

Please let me know how can i use Native Ringtone uri in Local Notifications.

Thanks in Advance.


#2

Issue solved by using file path plugin:

this.filePath.resolveNativePath('content://media/internal/audio/media/19')
    .then(filePath => {
      console.log(filePath);
      this.localNotifications.schedule({
        text: 'Delayed ILocalNotification',
        data: { doseid: 1 },
        at: new Date(new Date().getTime() + 5000),
        led: 'FF0000',
        sound: filePath
      });
    })
    .catch(err => console.log(err));