Swift: Local Notification on iPhone and independent Watch App - ios

I work on an app for iOS and watchOS. The watch app is independent but users will be able to use it side-by-side to the iPhone app, synced via iCloud.
The iOS app includes a daily reminder (via UNUserNotificationCenter) to open the app, the notification shows up on both devices (as usually with all other apps).
But what if the user only downloads the watch version of the app? I scheduled the same local notifications I have in the iOS app into the watch app, too.
Now, the iPhone gets the notification, and the watch gets two notifications.
How can I manage to get the iPhone notification only on the user's iPhone so that the Apple Watch does not receive two notifications? Or is there a smarter solution?
Thanks in advance

Related

Does it possibale to Develop an Apple Watch App to and IOS app to Support iOS Watches and other OS Watches

I have an iOS Application and am developing an Apple Watch Application for it.
The user should log in first to the iOS app and then we send the "Authentication log-in" to the iOS Watch App and the user can do some calls from its watch.
I'm Working on it as an extension of the main Application. and the Question is...
What is going to happen if the user has an iPhone and smartwatch which is not Apple?
Is there a way to send data from the iOS Application to the smartwatch (Android, Galaxy, and Huawei)?
Can the Application on the (Android, Galaxy, and Huawei) works like the one on the Apple Watch? or does it need a different development?.

iPhone - Apple Watch Sync (WatchOS 6) via CloudKit problem - Silent push notification

I watch the WWDC video regarding keep iPhone and independent watch app (watchos 6) in sync. So I have made a simple cloudkit subscription on the Apple Watch on a record (watch os 6).
1) On the iPhone I modify the record, but when the iPhone is unlocked the notification is never send from cloudkit to the Apple Watch.
If I modify the record directly on the cloudkit dashboard and
2a) the iPhone is locked, then the silent notification is sent to the watch. -> great!
2b) the iPhone is unlocked, then it is shown directly on the iPhone. For user visible notification this behavior make sense, but in case of silent notification it doesn´t, because there is no way if you change settings on the iPhone App (iPhone unlocked), that you get a push to the watch (via the cloudkit subscription).
Does anybody have the same problem or any way to get this working with cloudkit?

Apple Watch Instant Notification

Is it possible to send instant notifications to Apple Watch from an iPhone app? The Apple Watch guide says "Apple Watch displays those notifications at appropriate times". So looks like there is no guarantee that the notification will be instant. I'm developing an iOS app that provides navigational notifications so those have to be instant.
Unfortunately WatchKit doesn't support it at this time. Not only can you not guarantee when the notification will appear, you can't even guarantee it will show up on the Watch. The OS decides which device is active and routes the notification there.
You can schedule/fire a local user notification to make it shown on the Watch, with limitations:
Users may turn off notifications of your app on Watch.
Notifications are only sent to Watch when the paired iPhone is locked, and the watch is on the wrist.

Are iPhone's apps notifications going to be triggered on the Apple Watch by default, without even creating an actual Watch app?

I would like to support my iPhone's app Local Notifications in the Apple Watch from the very first moment the Watch is released, but I don't plan on building a Watch App yet.
From what I researched, it seems like iPhone's notifications will be automatically supported on the Watch, without needing any additional development or WatchKit implementation.
Apps are not required to do anything to support notifications. The system provides a default notification interface that displays the alert message from the notification. However, apps can customize the notification interface and include custom graphics, content, and branding.
Is this correct?
If so:
1. Will notifications on the Watch have action buttons just like configured for the iPhone app?
2. Is there any way I can test that on the simulator to be sure it works as expected?
If not:
3. Is there any way to support only notifications without creating a Watch app?
This is the more related question I found so far, but it's not really what I'm looking for. How to trigger notifications using WatchKit
I would like to support my iPhone's app Local Notifications in the Apple Watch from the very first moment the Watch is released
Yes notifications for your iOS application will work from day one on Apple Watch.
Will notifications on the Watch have action buttons just like
configured for the iPhone app?
If your iOS app already supports actionable notifications they will work with Apple Watch.
Is there any way I can test that on the simulator to be sure it works
as expected?
Good question actually, you can't test your current iOS app's notifications working on the simulator but you can test a custom notification interface from WatchKit.
You should file a feature request for this.
Is there any way to support only notifications without creating a Watch app?
No, you'll need to provide a sample Notification JSON payload as part of an WatchKit Bundle, which requires submitting an Apple Watch app.

Syncing LocaLNotifications via iCloud in background

Using iCloud I'm syncing my app data through all of the user's Apple devices.
The problem is that the user can create himself an alert and I want to do that if the user created a notification in the iPad, he would get the notification in the iPhone also, without the need of opening the app in the iPhone (to sync iCloud changes). I want the iCloud to sync in the background, only for the notifications thing.
Also, when a user gets a notification and opens the app in his iPad, the notification should be removed from all of his other Apple devices, it should be not seen in the notification center.
Is that even possible? Thanks a lot!
The only way for your app on the iPad to deliver a notification to the iPhone, assuming the app isn't already running on the iPhone, would be for the app to make a call to a server that would send an APNS notification to the iPhone.
As far as removing the notification, you have this sort of control over local notifications, but not over remote notifications. I don't believe there's any way with APNS to remove the notification from the other devices.

Resources