private UILocalNotification PrepareLocalNotification (NotificationData notification) {
if(notification!=null) {
notification.AppWasRunning = true;
UILocalNotification localNotification = new UILocalNotification();
localNotification.AlertBody = notification.AlertMessage;
localNotification.ApplicationIconBadgeNumber = notification.Badge;
localNotification.SoundName = UILocalNotification.DefaultSoundName; // defaults
if(notification.Sound != null && notification.Sound.Length>0 && !notification.Sound.Equals("default")) {
// for sounds different from the default one
localNotification.SoundName = notification.Sound;
}
if(notification.CustomDataJsonString != null && notification.CustomDataJsonString.Length>0) {
SystemLogger.Log(SystemLogger.Module.PLATFORM,"Custom Json String received: " + notification.CustomDataJsonString);
Dictionary<String,Object> userDictionary = (Dictionary<String,Object>) IPhoneUtils.GetInstance().JSONDeserialize<Dictionary<String,Object>>(notification.CustomDataJsonString);
localNotification.UserInfo = IPhoneUtils.GetInstance().ConvertToNSDictionary(userDictionary);
}
return localNotification;
} else {
return null;
}
}