How to programmatically exit Apple Watch app and return to watch face? - watchkit

When a Push Notification is received on an Apple Watch, pressing the "dismiss" button dismisses the notification and returns to the watch face screen.
Within my Apple Watch app, I would like to implement a similar experience to a notification. That is, tapping an icon or selecting a "dismiss" menu item would close or background the app and return the user to the watch face.
This behavior would allow the user to quickly select a new option and go back to the watch face in a single action, without fiddling with the digital crown.
Is it possible, from within an app, to programmatically cause the watch to return to the watch face?
On iPhones, the iOS Human Interface Guidelines prohibit applications from closing programmatically, as "people tend to interpret this as a crash."
However, the user experience of the watch seems much more oriented around liberally and regularly returning to the watch face. Is it possible to quit or background an app programmatically and return to the watch face, without the user touching the digital crown?

Related

Forcibly bring up a page with continuouse ringing to notify the user (even if the device is locked) in a Flutter app on both Android and iOS platforms

I'm currently developing an app for restaurants that receives orders from a firebase push notification.
I need a way to notify the users of the app by forcibly opening a page with a high volume of ringing (something like an alarm page, where you have a dismiss and a snooze button, or a phone ringing page with accept or decline call button) when an order arrives, so that they can dismiss and go to their current orders page.
My main issue is that I can't seem to be finding a way that opens this piece of UI forcibly on both Android and iOS platforms (since the app is being used on both), and even when the device is locked (though not mandatory, but could be super helpful).
If the issue is insoluble in one dart code, can someone please provide me with a way to implement on both of the platforms? Any workarounds are welcomed too.

Kill app in ios actually does not kill from OS

I m using Device.BeginInvokeOnMainThread(() => { Thread.CurrentThread.Abort(); });
System.Diagnostics.Process.GetCurrentProcess().Kill(); this in xamarin.forms to kill app in ios through dependency service.
But actually it is not killing the app when i press the home button it is still showing.
Can anyone help me out of this?
This is not possible. From the Apple technical Q&A (https://developer.apple.com/library/archive/qa/qa1561/_index.html):
A: There is no API provided for gracefully terminating an iOS
application.
In iOS, the user presses the Home button to close applications. Should
your application have conditions in which it cannot provide its
intended function, the recommended approach is to display an alert for
the user that indicates the nature of the problem and possible actions
the user could take — turning on WiFi, enabling Location Services,
etc. Allow the user to terminate the application at their own
discretion.
Although the documentation is pretty old, this still stands. Even if you do find some way to implement it, it will never be allowed to the App Store.

Making Network Requests in the Background on watchOS

I have a Apple Watch app that let's users record audio and they syncs it with the cloud. Once the user is done recording, I upload the file and some corresponding data.
Problem is that if I use a defaultSessionConfiguration for foreground requests, as soon as the app goes into the background (user drops their wrist), the NSURLSession pauses until the app is in the foreground again.
I've tried using a background session but that doesn't seem to work for data tasks. Any guidance on this would be much appreciated.

If Watch app opened before HealthKit accepted, show alert

Was wondering what the best practice for this is.
If an app that used HealthKit is downloaded, and then the Watch app is started before the iPhone app, HealthKit will not have been allowed yet.
In that instance, the user is going to think the Watch app is broken because no totals or data will be updated, etc.
Is there a best way to avoid this or at least alert the user that you have done or seen?
I'm assuming I'd set some sort of bool that is set to false, and maybe put an alert up on the first screen of the Watch app until HealthKit has been allowed.

Multittasking Shows Black screen for apps "UIApplicationExitsOnSuspend is set to TRUE"

I am building an app which exits on going to the background. I have set "UIApplicationExitsOnSuspend" flag to TRUE.
Multitasking feature
Keep the content of your app up-to-date by adopting the new
multitasking APIs in iOS 7. The new services allow your app to update
information and download content in the background without draining
the battery unnecessarily. The updates can happen at opportunistic
times and are intelligently scheduled according to usage, so your app
can update content in the background just when your users need it." to
do this "Double Press the Home Button
My app screen is shown as black screen in multitasking tray/app switcher till it comes into foreground.
Is there a way to show launch graphics/splash screen when the app is in the background during Multitasking tray/ app-switcher?
Can anyone please let me know how to show the launch graphics of my app during multitasking.

Resources