Alarm-like Application

末鹿安然 提交于 2020-01-15 09:11:33

问题


I have been researching for any possible way to do an alarm app like the app in AppStore (AlarmMon, Rocket Alarm). Which they can alarm with sound continuously even app is in background.

I've tried to turn off their location permission for the case that app using the CLLocationManager to update and extend the backgroundTimeRemaining.

When the alarm is playing sound, It doesn't stop even you receive a phone call (You can accept the call, talk to caller and hear their alarm sound simutaneously).

The VoIP & setKeepAlive is unacceptable by Apple. (Some developer told that their app got rejected when using VoIP)

Playing a silence sound seem to be a goodway for extending an backgroundTimeRemaining, but in the document its mentioned that you shouldn't play a silence sound.

What I've done

  1. AVFoundation (AVAudioSession, AVAudioPlayer)
  2. AudioServices (AudioServicesCreateSystemSoundID, AudioServicesCreateSystemSoundID, AudioServicesPlaySystemSoundWithCompletion)

The second way is working fine with playing sound and vibrate the device, but the problem is it cannot be played over 180 seconds (backgroundTimeRemaing).

Key Condition that they said in their app (AlarmMon)

The application cannot be killed by user. If app get killed by user, It will send a loop of a local notification instead. (Local Notification from app is exceed the maximum number that mentioned by Apple (64 times) and It push one by one continuously.)

来源:https://stackoverflow.com/questions/38983753/alarm-like-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!