EddyVerbruggen / nativescript-local-notifications

:mailbox: NativeScript plugin to easily schedule local notifications
MIT License
162 stars 57 forks source link

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

Open maniacube opened 7 years ago

maniacube commented 7 years ago

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

EddyVerbruggen commented 7 years ago

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.

maniacube commented 7 years ago

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); } );

ickata commented 7 years ago

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.

blove commented 5 years ago

@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!!

ickata commented 5 years ago

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

NL33 commented 4 years ago

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