Android Wear: implementation of standard Timer App - wear-os

I'm trying to implement the same app as standard Timer app (for learning purposes).
Is it available sources of standard Timer app installed on Android Wear?
How to implement starting and displaying Activity from Sleeping Mode. Like green screen in Timer app, that appears when timer reach zero. (the problem: flags FLAG_TURN_SCREEN_ON, FLAG_KEEP_SCREEN_ON, FLAG_SHOW_WHEN_LOCKED and FLAG_DISMISS_KEYGUARD in onCreate method don't help to cancel Sleep Mode Screen and display target Activity to user).
Cheers!

Related

How to ensure that a Xamarin Forms app (AVAudioSessionCategoryPlayback mode) is suspended correctly by iOS to prevent battery drain?

I have a Xamarin Forms app running in AVAudioSessionCategory = Playback mode and it works very nice, background audio is playing and even my timers keep running in the background, which is fine during playback.
How can I ensure that after a user has decided to stop playing audio (either by pressing a button inside of the app or by pressing the pause button on the lock screen) my app will go into a Suspended state and it won't drain the battery?
Is there a way to either force my app to go suspended or a way to verify whether it has?
As a side-note: Hooking the OnSleep method in App.xaml.cs is NOT sufficient because it is being called every time the app goes to the background even if it's playing audio, my timers are running, HTTP calls working, etc.
UPDATE:
Made an interesting discovery today:
Timers keep running running in the background when the app is started from Visual Studio in debug mode (over WiFi).
Timers seem to get suspended automatically by the OS (iOS) when the app enters background in Release mode.
My conclusion is: maybe the entire problem lies somewhere in the 'framework' that is added to the app by Xamarin to ensure communication between Visual Studio and the app? (Console, breakpoints, etc.) It would be a logical explanation.

How to schedule local-notifications when the app in background for iOS in Nativescript -angular

Hai am developing an ios application using Nativescript-angular framework.My app contains local notifications functionality using timer. but I click the home button In my phone the timer was destroyed and notifications not came. Is there anyway to run the timer when my app is in background?
In order show notifications after app is moved to background, you should use BackgroundTask.
If you like to perform any operation even when the app is not running, then you should opt for BackgroundFetch

Can I keep a Watch app running in background?

I know iOS allows background tasks to run and, for example, continue to receive location updates, but is it possible to do this in a watch app?
In Xcode 9.3, I have configured my app for "background modes" and selected location, and that has created for the WatchKitExtension's an Info.plist, an entry for "Required background modes" of "App registers for location updates".
But my watch app still suspends when the screen turns off, and when it is in the dock.
The App Programming Guide for watchOS, however seems to exclude the possibility of running in the background to receive location updates as it only allows background processing for four classes of activity:
Background App Refresh Tasks. Use a WKApplicationRefreshBackgroundTask object to ...
Background Snapshot Refresh Tasks. Use a WKSnapshotRefreshBackgroundTask object to update ...
Background Watch Connectivity Tasks. Use a WKWatchConnectivityRefreshBackgroundTask object to receive data sent by your iOS app ...
Background NSURLSession Tasks. ...
Other posts to SO indicate it's not possible, but proving a negative is difficult, so I'm asking again:
Am I "flogging a dead horse" by trying to keep the watch App operating in the background for receiving location updates, or is Xcode is making promises that WatchOS won't deliver.
I'm delighted to be able to report that the horse I have been flogging for the past two weeks was not dead after all!
I have discovered an additional state in which my watch app will continue to run in the Background which does not require HKWorkoutSession.
These settings did the trick:
locationManager.allowsBackgroundLocationUpdates = true
and in watchKitExtension info.plist:
set UIBackgroundModes (Required background modes) to location (App registers for location updates)
And I repeat: I am NOT using healthKit
Now my app continues to run even when the screen is off and when the app is out of the Dock.
No, it is not possible.
As the WatchKit Programming Guide clearly states, WatchKit apps cannot use background execution except for 3 use cases:
Network operations using URLSession
Playing audio using WKAudioFilePlayer or WKAudioFileQueuePlayer
Run a workout using HKWorkoutSession
You cannot receive location updates in the background, according to the WatchKit Programming Guide, that should be done in the iOS app that is connected to your watchOS application.

Windows 8.1 Universal App Multitasking Foreground-Background Cycle

Is there a way to know if the app is sent to background or brought to foreground. I don't mean Suspended and Resuming events.
For example, user leaves the app to check something on Facebook app for a min. And then return to back to my app. So suspention doesn't take effect on this scenario. Then how to know user is back to the app on app.cs level?
As stated in the MSDN documentation:
Your app doesn't receive an activation event when app visibility changes, because the app is still running. Windows simply switches to and from the app as necessary. If your app needs to do something when the user switches away and back, it can handle the visibilitychange event (for HTML) or Window.VisibilityChanged event (for XAML).

Using timer in Windows Mobile during standby

I want to use a timer in a windows mobile app. Of course, this is not the problem.
The problem: the timer needs to be called even during standby and sleep mode.
Simply switching off the sleep mode is not really an option, since the app needs to comply to windows marketplace for mobiles requirements, and regarding to requirement 5.2 a marketplace app "shall not modify power management options".
Is there a system timer, which could be used to get an event called (like CeSetUserNotificationEx can be used to get an app started)?
Or how would I create a persistent timer?
CeRunAppAtTime can be used to set a named system event (not just to run an app). If the device is in sleep mode when that time arrives, it will wake.

Resources