nativescript-local-notifications icon indicating copy to clipboard operation
nativescript-local-notifications copied to clipboard

Not Getting iOS Local Notification Sound On "nativescript-local-notifications"

Open maniacube opened this issue 8 years ago • 6 comments

Hi,

Problem:- When we set some custom audio sound file to "nativescript-local-notifications", we are not getting local notification sound. If we didnt set any custom audio sound file, we are getting default notification sound. Please help us to resolve this.

Platform:- iOS

maniacube avatar Feb 22 '17 06:02 maniacube

I'm sorry but I don't understand, can you please rephrase what you do and what you expect? Code samples would be nice as well.

EddyVerbruggen avatar Feb 22 '17 19:02 EddyVerbruggen

Hi @EddyVerbruggen,

                               We are not getting sounds on local notification when we set custom tones.  In android it is working. we are facing problem only in iOS. Please find below codes.

LocalNotifications.schedule([{ title: title, body: body, at: time, sound:"~/sounds/alarm.mp3" // custom tone from our local folder }]).then( function() { console.log("Notification scheduled"); }, function(error) { console.log("scheduling error: " + error); } );

maniacube avatar Feb 23 '17 07:02 maniacube

Hi @maniacube ,

At the time of submitting this issue custom sounds were not yet supported. This has been fixed with this merge. Unfortunately, npm is not yet updated, so can you please try adding this plugin from GitHub instead of npm, like this:

  1. Edit your package.json:
  "dependencies": {
    ...
    "nativescript-local-notifications": "https://github.com/EddyVerbruggen/nativescript-local-notifications/archive/master.tar.gz",
    ...
  },
  1. Run:
rm -rf platforms hooks node_modules
tns platform add ios
tns platform add android
tns run ios
tns run android

Please let us know if this helps.

ickata avatar Aug 05 '17 11:08 ickata

@ickata is this still an issue? I can't imagine it is, but I am also having issues with a custom notification sound using this plugin.

I have followed the instructions:

  1. Placed the file reminder.wav in the App_Resources/iOS directory
  2. Specified the filename 'reminder.wav' as the value of the 'sound property.
LocalNotifications.schedule([
  {
    id: ReminderComponent.ID,
    title: 'Saturate',
    body: "Alert",
    color: new Color('#f6f1eb'),
    badge: 1,
    ongoing: false,
    interval: 'day',
    sound: this.sound ? 'reminder.wav' : null,
    at: date
  }
]).then(
  function() {
    console.log('Notification scheduled');
  },
  function(error) {
    console.log('scheduling error: ' + error);
  }
);

Are there any known issues using custom sound on iOS devices? Thanks in advance for your help and thank you very much for creating this plugin!!

blove avatar Jan 13 '19 01:01 blove

Not sure. The project I was using local notifications with sound was discontinued long time ago.

ickata avatar Jan 13 '19 08:01 ickata

I am struggling with the same issue. I have opened an updated request here.

NL33 avatar Sep 19 '19 19:09 NL33