I want create alarm app for my apple watch but I don't know how to wake a person. There is an app - Sleep Cycle and they trigger something that looks like on picture:
Watch vibrates constantly like default timer app on apple watch. The question is what's the name of this interface element? This not a notification, not an Alert (https://developer.apple.com/documentation/swiftui/alert), not a WKInterfaceDevice play function. I just want reproduce that behavior. Thanks for help!
What you need is notifyUserWithHaptic, it gives a repeating haptic and also displays this notification style screen with Open and Stop buttons if the app isn't active.
As per Apple Docs
For schedulable sessions such as smart alarms, call this method during
the session to alert the user. When you call the method, the system
plays repeating haptic feedback. If the app isn’t active, the system
also displays a system alarm alert on the watch.
Link to Apple Documentation
Related
I'm having the current problem with Slot Filling in a Scene:
My desired behavior is: when I call an intent "participateSurvey", I call my Webhook that retrieves the live survey and fills dinamically a slot with the possibile options, then prompts the user that selects the option.
I've currently implemented it this way:
the intent "participateSurvey" redirects to the Scene "participateSurveyScene" which has a single slot "chosenOption", set as Required. In the console I set the flag "When you first prompt users.." to call my Webhook.
The Webhook fills the dynamic options and send this response
When testing I see that the Slot is correctly requested:
But using the Google Nest, when invoking the Intent after the response of the Webhook the Microphone is not opened, I've to say again "Ehi Google" and then answer and it's not great. This happens only if I go through my Webhook before the slot filling, which is what I need in this case.
Can someone please assist me? I'd like to open the microphone and listen to user answers automatically even when I prompt from the Webhook. Thanks in advance!
I'm working on a standalone countdown App for Apple Watch. When the timer is over, the watch rings or vibrate.
There are three different situations where this can happen:
The app screen is active on the user's wrist: that's the easiest part; when the timer is over, the app runs a sound/haptic feedback, no need for anything running in the background. No problem with that.
The app is in the background: Using notifications seems to be the obvious choice, and it already works very well.
The app is in the foreground, but the screen turns off either because it reached the maximum wake duration (15 or 70 seconds) or because the user rotated his wrist back in rest position, which automatically turns the apple watch's screen off.
This third and last situation is where I'm confused. Neither the first nor the second situation works here: when the app is active, but the screen turns off, the app stops running, but the notifications are still not triggered since the app is technically not in the background.
Are there any straightforward ways around this problem?
Use Extended Runtime Sessions to create smart alarms
like this:
func notifyUser(hapticType type: WKHapticType,
repeatHandler: ((UnsafeMutablePointer<WKHapticType>) -> Time
Interval)? = nil)
Apple Documentation
For schedulable sessions such as smart alarms, call this method during the session to alert the user. When you call the method, the system plays repeating haptic feedback. If the app isn’t active, the system also displays a system alarm alert on the watch.
The haptic feedback repeats at the interval specified by the repeatHandler, and continues to repeat until the application or system alert invalidates the session.
If the app isn’t active, the user can tap the Stop button to invalidate the session or tap the Open button to activate the app.
If the app is active, the app must invalidate the session by calling its invalidate method.
Only call this method on a schedulable session that’s running: you must schedule the session using the startAtDate: method, and the session’s state must equal WKExtendedRuntimeSessionStateRunning. During a smart alarm session, your app must call this method before the session expires.
Also you should check out the life cycle of watchOS app
Just wanted to know from a high level how I would accomplish this.
I thought that when a user opens the application, I will keep track of the last opened time in a Dynamo DB table.
Then I could have a background worker constantly check and see if anybody hasn't used their app in 3 or 4 days and then send a push notification, ie, "you haven't used your app in a while, why don't you open it up and do XYZ."
From a very high level, there are two possible ways:
1.) Local notifications (you don't need AWS for this):
You can schedule a local notification, every time the user opens up the app (or better - every time the user brings the app to foreground). It works like: User opens app -> cancel old scheduled notification if existing -> schedule new notification for "in 3 or 4 days" -> ready :-)
You can use something like this: https://github.com/zo0r/react-native-push-notification (see section Sheduled Notifications).
2.) You could do it with remote notifications (https://aws.amazon.com/sns/):
You can go the way you proposed. Then you have to store an entry in your db with the push notification token of the device and the last time the app was opened. Your worker then has to check and send the push message to the device using a service like SNS.
I would recommend 1.) over 2.) because you are independent from the users internet connection when getting the app opening info. In 2.) you can miss the opening info, when the user opens the app without internet connection. Also 2.) is more expensive then 1.) when you scale your app.
An advantage of 2.) would be, that you are more flexible when and what you send in your notification, since you can edit it on server side. 1.) would mean that it is coded in your app (at least until you build a synchronization mechanism for the variables) :-)
I have a situation where a user can modify an Excel like grid schedule online. I would like to be able to show a message stating that the schedule is being modified in another window. However, how can I do this with a window open, and if the previous window was closed with SignalR. For other sessions I just want to state another user is modifying the schedule.
It might be easiest to use localStorage to communicate between multiple tabs/windows a single user has open: http://www.codediesel.com/javascript/sharing-messages-and-data-across-windows-using-localstorage/
You can listen for the storage event which is triggered on every window a user has open on your site when you call localStorage.setItem or localStorage.removeItem.
Of course, it would still make sense to use SignalR to notify other users.
If you cannot use the localStorage API for some reason, you can still use SignalR to send a message to every window the user has open by using Clients.User(userName).... inside your Hub. By default, userName should match your user's IPrincipal.Identity.Name, but you can register your own IUserIdProvider to customize this: http://www.asp.net/signalr/overview/signalr-20/hubs-api/mapping-users-to-connections#IUserIdProvider
Using Facebook real-time updates I want to get notifications when and user (of my application) has connected with another (not necessarily of my application). It looks logical to subscribe using object="user" with fields="friends" which I did. The problem is the amount of notifications I'm getting (too many): it looks like I'm notified not only when an user connects/disconnects with another. Is it possible to get notifications ONLY for these types of events?
Thank,
George