Prevent Screen Light TURN OFF | Disable Sleep Mode in Watch Interface - ios

In Apple Watch Interface, After some time screen light Turned Off. I want to prevent screen light Turn off. I have implemented timer like functionality, That will display objects and continuous change it (Like Photo Slider Album). It's long-running task 160-240 seconds.
Everything working fine BUT screen light turn off After some time. Is there any way to continues to Activate Watch Screen light?
Simply, I want to Turn ON watch screen light 160-250 seconds anyhow...

The timeout is a system limitation to conserve battery life, so it is not possible for a developer to prevent the Apple Watch display from entering a sleep state.

Related

How to avoid an Apple Watch 2 App to stop running after a few seconds the screen turns into black?

I am developing an Apple Watch2 App. My app stops running after a few seconds the screen turns into black but I want my app to run on the screen even after the screen turns into black. So that the user can see my app anytime on the screen by not tapping to the app icon again.
I tried to add a timer and then an animation and also made dynamic UI changes to avoid my app to stop running but it didn't work - after a few seconds the screen turns into black, the app stops and the main watch clock screen comes into display.
I saw that it is possible to do this functionality in "Apple Workout App". When the user starts a timer, even if the screen turns into black, the app doesn't stop running so the user checks the timer anytime she/he wants. So please let me know how I can get this functionality?
Thanks,
E.
You can't control this from your app; The user selects the behaviour for their watch using the Apple Watch app on their phone. They can select "Show watch face" (the default) or "Resume Last Activity". They can also select how long the display stays on for on a tap; either 15 or 70 seconds.
Some Apple apps such as Maps, Remote and Timer can override this setting and if a fitness app has an active HealthKit workout activity then the watch will also resume the last activity on wrist raise/face tap. If your app isn't using HealthKit for a workout activity then you have to live with the behaviour the user has selected.

Sleep Cycle - What kind of Backgroundmode is this?

I'm currently working on an app which reminds the user, when he gets to an certain location. I want this app working in background as well and searched for solutions.
In the AppStore i found the App called Sleep Cycle, which tracks your activities during your sleep. When you set the alarm, and running the App in the Background you get this screen red bar on the top of the Display of your iPhone.
http://i.stack.imgur.com/uEejp.jpg
Does anybody know what kind of Backgroundmode this is, and how i can transfer it to my app?
Thanks
To have such a red bar I use audio background mode and also I record sound in background. Since Sleep Cycle asks user to allow access to microphone I believe it also records audio in background

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.

iOS - show consistent alert at the top of the UI when backgrounding the app (like personal hotspot does)

I am creating an alarm clock app that requires some user action within the app in order to turn the alarm off. Below is a picture of what another app, Sleep Cycle, does when you turn an alarm on and press the home screen (i.e. background the app).
Here is an image link (I can't post an image yet, no rep despite my many attempts to answer people's questions today) for the effect I want to re-create.
Those that have used iPhone's Personal Hotspot and connected a device will notice that it is the same effect, where a notification appears at the top of the UI - pushing everything down by around 20-40 points. This is highly desirable to an alarm clock app as it encourages the user to keep the app in the foreground so that the app can easily be entered when waking up (instead of relying on the 30 second sound window allowed by local notifications)
Does anyone have any ideas on how to implement this functionality. I assume that it must go somewhere in the:
- (void)applicationDidEnterBackground:(UIApplication *)application
tag within the AppDelegate, but I'm not sure what exactly I need to be reading up on. So if anyone has a link to some relevant Developer Docs that would also be extremely helpful.
Many thanks for your help,
Ryan
There are a handful of built in 'background modes' that change the status bar's appearance depending on what functionality an app provides whilst it's in the background. The one you've identified (a red status bar) is triggered when an app records audio whilst in the background. I presume Sleep Cycle must be acting as though it records audio just for this purpose. Other background modes include VoIP (which I think uses a blue status bar). Check out Apple's documentation on supporting these various background modes
In your case, you'd want to add audio to the UIBackgroundModes property in your Info.plist file.
But note that it wouldn't be unreasonable for Apple to reject an app during review if it pretends to perform one of these background tasks but doesn't. For example, there have been apps in the past that tried playing a silent audio clip continuously in order to stay awake in the background - needless to say Apple got wise to this and the app in question had to change its behaviour.

Lock and unlock screen - iPad

Would it be possible to lock a device screen and unlock it again? The reason I would want to do this is we have a kiosk type app and we would like to turn of the screen between certain times.
I would think a type of push notification would be needed?
Once iPad is locked you're not going to be able to unlock it programmatically, even through a push notification. Assuming these devices are always plugged in you may be better off turning off the idleTimer (which I'm assuming you already have) then invoke some sort of screen save or idle screen that displays during those hours. That way your app never allows the iPad to lock natively and you can control when clients do & don't see the content.
That brings up a design question, though... what happens if someone is present when the idle screen is up? Should you override or keep it on the idle screen? Just thinking out loud.

Resources