Can watchOS send a local notification?

In my current WatchKit app, the parent application counts steps (CMPedometer) and sends a notification after a certain number are met. I'm trying to figure out how much of this functionality can be accomplished with just a native watch app. Can we count steps in the background? Can we send notifications?


The parent app currently counts steps in the background while music is playing (all part of a fitness app).


Thanks!

Currently to do this, I think it's like in watchOS 1 where you'd have to ask your main iOS App to set this up for you: use

WKInterfaceController.openParentApplication(...)
and then handle the request in your AppDelegate to set up the notifications. Make sure you do it in the background since the
handleWatchKitExtensionRequest
doesn't give you much time to process.

I'm afraid you're right (and yes, that's what I'm currently doing). This means I can't leverage the pedometer on the watch though, I'll still depend on counting steps on the phone in order to send notifications using that information


There isn't a way to for the parent application to ask the watch for its pedometer data, is there? Of course the watch app can send that data to the parent app while it is active, but I'm looking for a way for the parent application to request that information even if the watch app isn't active.

I just found out about the WatchConnectivity Framework: https://developer.apple.com/library/prerelease/watchos/documentation/WatchConnectivity/Reference/WatchConnectivity_framework/index.html#//apple_ref/doc/uid/TP40015269


The Watch Connectivity framework (

WatchConnectivity.framework
) provides a two-way communications conduit between an iOS app and a WatchKit app on a paired Apple Watch. Apps use this framework to pass files and data back and forth. Live communication is possible when both apps are active; otherwise, you send data in the background so that it is available when the other app launches.

So yes, you can request pedometer data from the Watch app in the background!

Currently, you cannot post a local notification on watchOS. You will need to use the WatchConnectivity framework to wake your iPhone app. Then, the iPhone app can post the notification.

What if the two devices are currently not paired? Does the watch then just become incapable of alerting the user to a task being finished (say for example a timer running, sent to background to local notifications are set so the user is notified)?

If the Apple Watch currently isn't connected to its paired iPhone, then you are correct — the watch will not be able to post notifications.

Thanks Tom for your responses to help clarify the current state of WatchKit.


I'm working on a watch OS2 timer app that's nearly useless without scheduled notifications. There are countless, useful scenarios for when apps would want to request permission and schedule notifications to help alert the user about an update (without having their phone nearby).


Scheduling local notifications from the watch seems like an essential feature that will *eventually* get added to WatchKit. I don't suppose there's a publicly available ballpark ETA (months, years, etc) on when we can schedule notifications from the watch.

I agree, this seems like an oversight. I filed a feature request bug report. Maybe if enough people do the same, Apple will listen.

Notifications can now be sent from the Watch itself as of watchOS 3 using the User Notificaitons framework.

Can watchOS send a local notification?
 
 
Q