Im implementing a fake call app.Im using a NSTimer for checking the time and it is working fine.The problem is when we press the sleep button,only vibration is working but ring tone is not playing.I tried this code but still ring tone is not playing.
AudioSessionSetActive(true); // Set up audio session, to prevent iPhone from deep sleeping, while playing sounds UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty (
kAudioSessionProperty_AudioCategory,
sizeof (sessionCategor开发者_JAVA百科y),
&sessionCategory
);
How can i solve this issue.please help.Thanks in advance
I am sorry but I think You can not show calling screen while device locked (deep sleep). The only way is to fire local notification to wake up your application manually by user. Something like : You have fake call now. Do you want to receive ? So when user press Yes and it will open your application and you will need to handle to show calling screen in appDelegate background methods.
I played with other Fake Call apps and they are doing same. We are not allowed to do any UI Changes in background. So this is the only way to achieve your goal to display calling screen.
Hope this help.
Edit:
I am not sure why vibrate is working. Did you set below property in your info.plist file ? Just to give it try. Not sure that will solve your problem. Just give it a try once. See attache picture. Set Required Background modes to App Plays Audio.
精彩评论