How to test push notification on the Apple watch? - apple-watch

I'm able to test push notification using Apple Watch simulator and the "PushNotificationPayload.apns" file by selecting Notification:
How to test push notification on the actual Apple Watch?
--> I've tried to use exact steps for simulator. But the Apple Watch will just launch the app, bypassing the notification view.

The APNS file is available only for testing in the simulator. It doesn't work on a real device. You'll have to test push notifications the same way you would for an iOS app: actually sending a push notification to the device.

There is a simple process to test the push notification on Apple Watch. It is same as in iPhone. Also Inside your iPhone -> Apple Watch-> Notifications -> Mirror iPHONE alerts From-> turn on your notification.
There are following things which you need to take care while testing the Push notification on Watch:-
1) IPhone should not be active and Watch should be active.
2) IPhone and watch both should not be active.
3) IPhone and watch both should not be deactive.

Related

IOS & WatchOS background communication

I have a IOS application with a companion WatchOS application. I am wondering if there is a way I can communicate with the IOS application in real time while it not running as a foreground application.
The best example I can think of is how your are able to use the Spotify watch app to change songs, like songs or even change the volume of the phone while the phone is locked.
How could I implement something like this for an application that could possibly send data frequently from the watch to the phone while the phone is locked.
Watch apps can launch their companion iOS apps by messaging them:. https://developer.apple.com/documentation/watchconnectivity/wcsession/1615687-sendmessage
That won’t work if the iOS device requires unlock because it’s just booted up.
I just started WatchOS development and needed to send a message to the watch app - if it's available I use sendMessage. If the watch app is backgrounded, I use transferUserInfo. Link to code snippets. I check isReachable and isPaired (on the phone, isPaired does not exist in WatchOS).

silent push notifications in ios10

Hi i was stucked in silent notifications in ios10
i gave support to ios 10 as said in this link
Push notification issue with iOS 10
it is working fine in iphone 6 (calling background fetch completion handler)
when it comes to iphone 5 device not working properly
when i push silent notification device in background not responding completion handler why i didn't understand

Push notification on iMessage Extension App

I'm creating an iMessage Sticker Extension App on iOS 10. I'd like to push remote notification when the system have a new sticker.
Can we do that?
If your extension is embedded into an iOS app, you could use the iOS app as the receiver of the push notification. That will work for sure.

Show a notification from watchOS 2 app

It is possible to show a notification from Apple watchOS 2 native app? Although watchOS 2 applications can run directly on the Apple watch device, it still hasn't reference to the UIApplication.SharedApplication, so I can't all the UIApplication.presentLocalNotificationNow() directly from the WatchKit app an it seems that also the WKExtensionDelegate cannot be used to show instant notifications.
The WKExtensionDelegate can respond to local notifications via the didReceiveLocalNotification(_:) method. Your iPhone app will have to schedule the notification. If it is an even that only the watch knows about, you can send a message to the phone app using the WCSession set of APIs.

How to send msg between iPhone app and WatchKit app?

I am newer one for Apple Watch development.
Can you please provide me about how to communicate from iPhone app to Watch app and from Watch app to iPhone app ?
As I can see, there is a notification controller which is related Apple Push notification. I would like to connect to Watch app directly via Bluetooth or something. For example, As soon as iPhone app sends a MGS to Watch app, the watch app shows this MSG without any delay.
Thank you.
In order to communicate with the iPhone app from your Watch extension you can use openParentApplication(_:reply:) since Beta 2.
For the other way around I have been putting a file into the shared app group folder and monitor it from the Watch extension. If the iPhone app modifies the file the Watch extension will be notified and can act on it.