Hi,
I have used the code from apples example from this page: Link, but I can't seem to get the sound to repeat. I have checked other applications, such as skype (for VOIP) and Alarm Clock Pro (audio?) but I cannot get the sound file to be repeated.
This is my code:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
AlarmHandler *AHinstance = getAlarmHandlerInstance();
UIApplication* app = [UIApplication sharedApplication];
NSArray *alarmList = [AHinstance getAlarms];
NSArray *oldNotifications = [app scheduledLocalNotifications];
if ([oldNotifications count] > 0)
{
[app cancelAllLocalNotifications];
}
for (Alarm *theAlarm in alarmList) {
NSDate *alarmDate = [theAlarm getNearestActivationDate];
Package *alarmPackage = [theAlarm getAlarmPackage];
NSArray *fileList = [alarmPackage getVoiceFileListForBackgroundNotificationWithHour:theAlarm.larmHour];
if( alarmDate == nil ) continue;
UILocalNotification* alarm = [[[UILocalNotification alloc] init] autorelease];
if (alarm)
{
NSLog(@"File: %@", [fileList objectAtIndex:0]);
alarm.fireDate = alarmDate;
alarm.timeZone = [NSTimeZone defaultTimeZone];
alarm.soundName = [fileList objectAtIndex:0];
alarm.alertBody = @"Time to wake up!";
alarm.repeatInterval = 0;
[app scheduleLocalNotification:alarm];
}
}
}
Any suggestions on how I can fix this?
I have had suggestions to register app as audio player and play sounds in the background, but it seems that apple does take kindly to those applications because they aren't real audio players. Therefore they deny those apps.
Regards,
Paul Peelen