0

I am trying to add a custom sound to at push notification with PushSharp, but I can't find any documentation about this. I am using a windows service in C#, and every thing worked with default sound. But when I use this code I either get default sound og no sound.

push.QueueNotification(new AppleNotification()                                        
     .ForDeviceToken(deviceToken)                          
     .WithAlert(FormatMatchesMessage(offers))                      
     .WithSound("Jingle.mp3"));

I have the sound file included in the C# project, and also included in the iOS app project.

What do I need to do to make it work? Is it something about filetypes?

Morten Holmgaard
  • 7,484
  • 8
  • 63
  • 85

1 Answers1

0

I have never used PushSharp, but the normal way of adding sounds to Push notification is to simple specify the full filename, as you do. Are you sure the sound name is correct and the file is available in the app?

You can try scheduling a local push notification with the sound by calling a method like:

+(void)scheduleNotificationForDate:(NSDate*)date withMessage:(NSString*)message andOKButtonTitle:(NSString*)buttonTitle andPayLoad:(NSMutableDictionary*)dic andSoundName:(NSString*)soundName
{
    UILocalNotification *not =[[UILocalNotification alloc] init];
    not.fireDate = date;
    not.alertBody = message;
    not.alertAction = buttonTitle;
    not.soundName = soundName; 
    [[UIApplication sharedApplication] scheduleLocalNotification:not];
}
EsbenB
  • 3,356
  • 25
  • 44
  • I just tried that - and it works with the local notification. What could then be the problem? I have verified the name. – Morten Holmgaard Aug 20 '13 at 09:28
  • well, it could be an issue with PushSharp. You could test another Push Service Provider (e.g. UrbanAirship - We are pretty happy with their service.) – EsbenB Aug 20 '13 at 09:41
  • Hmm.. When I tried again after the local notification test it worked - also on other devices.. – Morten Holmgaard Aug 20 '13 at 10:37