How to create a custom alarm wake up screen on iOS? - ios

Is it possible to create a custom alarm wake up screen on iOS via Xcode, such as the carrot alarm app on the App Store? If so, could anyone point to some documentation or examples?
I'm pretty confused at the moment, because I don't understand how it can be done as long as the iPhone locks itself and the app stops working. This is my main concern, because locking the iPhone kills the app.
I would like to what's the best way to create a wake up screen like carrot app's one, avoiding all the screen lock problems. How did they do it?
Thanks

Using the code below you can disable the lock screen. You can place it in your viewDidLoad method.
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
As for creating the screen, I'd suggest picking up a book on iPhone development as it's a lot to explain in a follow-up message.

Related

Is there anyway to stop screen-lock while my app is in foreground in iOS App?

I do not want the user to be able to lock the screen while app is in foreground, even when the user forcefully tries to lock the screen with hardware lock button. Is there anyway to make it function programmatically?
Please do not tell me idleTimerDisabled property of UIApplication class.
[UIApplication sharedApplication].idleTimerDisabled = YES;
It does not work for what i'm looking.
This is not possible using the iOS SDK. You have no mechanism for making the user unable to do things like lock the screen or not press the home button.

Create Lock Screen Notification Like Apple's Alarm App?

currently when my application is on lock screen, I just have a basic UILocalNotification pop up that opens the app when pressed and so on. However, I'd really like to make that better looking and I was wondering how Apple's Alarm Application has it's own unique notification on the lock screen? Does this also deal with manipulating notifications? Please, any help would be greatly appreciated...I've been searching for weeks :( alarm app lock screen example
So for now it is not possible to create a custom type notification like Apple Alarm Clock. There is no trace of it in UIKit framework docs. All we have is basic UIAlertController and UILocalNotification classes.

iOS:how schedule the app from background to foreground

I am coding for connection between iPhone and my smart watch by bluetooth low energy. The functionality is "find my phone", touching the watch then iPhone will alarm. During the process, I want to my app will being active. It can be scheduled to the foreground from the background, so we can do more other thing! But I am not able to find the api about it, anyone can help me, thanks?
You can not force an application to bring it to foreground.
Please see this answer for help.
https://stackoverflow.com/a/22930371/1891327

UILocalNotification not firing properly on iPhone when app not foregrounded

UPDATE - a warning to anyone with similar symptoms... check Do Not Disturb is not active!
I finally paid to get an app I was working on running on my iPhone instead of on the simulator.
Having done so I've spotted a strange behaviour with regards to the UILocalNotifications that I create, which are set to use the default sound UILocalNotificationDefaultSoundName, and the default timezone ([NSTimeZone defaultTimeZone]).
If the app is foregrounded then the local notification fires on time and I receive it within
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
and I create an alert view to display it.
If however I lock my phone just before a notification is expected then nothing appears on the screen, but when I press the home button to show the lock screen I can see my app's notification in the notification centre on the lock screen. No sound was played, but then again the phone didn't wake up to show the notification properly.
If however I just press the home button so the app is put in the background leaving me looking at the springboard apps then I don't see any notifications whatsoever, and again no sound is heard.
On the simulator the same code correctly fires the notification banner when looking at the app icons in the spring board, although I've never been able to hear any sounds for the notification. But as the simulator doesn't let you configure the notification centre for apps I always presumed it was perhaps set to not allow sounds. On my device sounds for this apps notifications are enabled, and i've tried it with banner and alert modes, with no joy. Very frustrating.
Has anyone experienced this, or have an idea what could be going on?
Oh the irony of this answer.. think it's time to go to bed. My iPhone thinks that too for nearly 3 hours now... My question happily describes Do Not Disturbs behaviour, which was active.. Sorry to waste everyones time!!

Shake functionality in a music application

I have developed a small music app by using AVPlayer and MPMediaPickerControlLibrary with all the normal required functionalities for a music app. The app is also capable of running in the background when the screen is locked.
Now, what I want is to start the app when the screen is locked through a shake and soon as the app starts the current song should start playing.
I am not able to achieve this from a long time
Any suggestions on this will be highly appreciated or any other workaround apart from shake to turn on the music in the app when the screen is locked in iPhone.
Thanks in advance.
You need to implement the a CMMotionManager object, but keeping it running all the time in background will be a major power consumption issue.
Modifying the updateInterval property to reduce the number of updates will defeat the purpose, given that you may miss a shake in background.
Now, if the app was terminated by the user, then no motionManager object will be available until the user launches the app again.

Resources