How to show notifications in iWatch? - ios

I am working on an iWatch application. I am doing a sample app using swift and my requirement is to display LocalNotifications. When i run my app in my iPhone simulator i’m getting the notifications but i'm not getting notifications when i run the app in iWatch simulator. Can any one explain me about how local notifications display in iWatch.
Do we need to design any UI to show the notifications on iWatch i.e static or dynamic interfaces in iWatch Interface builder?
Thanks in advance.

Run your watch app Select notification target on simulator, dismiss the notification and stay on clock face.
Hit ⌘L to lock iOS simulator.
Enjoy notification arriving to watch app.

Related

From WatchOS App connect BLE device using iPhone Bluetooth

Hi everyone here it's my problem, I have an simple app on my Apple Watch and iPhone. All my goal is using iPhone minimum on the App. Instead of iPhone App I want to use this App mostly from the watch. So I have an UI screen consisting with 2 buttons (Scan and Connect) on the watch. And these buttons should control the iPhone's Bluetooth. I don't want to use Watch Bluetooth. Considering all, is it posibble to trigger the iPhone Bluetooth in background from Watch and connect iPhone to a BLE device.
I think I fix this problem with your help guys;
Hi again, I believe I can fix this problem with the background transfers. Let me first explain the problem better when I want to use iPhone App local database and also want to use iPhone's Bluetooth from the Watch App I had trouble. And then I noticed sending messages from Watch to iOS wakes up iOS in the background (Source for more detail). In this way I'll have using iPhone app only in background and even scan BLE devices from the iPhone in bg and send them to the Watch App (WC Sessions).
Source (Communicate with iPhone and Watch)
https://medium.com/#jackywangdeveloper/apple-watch-communication-with-iphone-af84d51ff810

Why push notification is shown when app is foreground? (iOS10 / iPhone 7)

I'm having weird experience.
Why push notification is shown (in native banner) when app is foreground?
It's only reproduced on iPhone 7 (iOS10.1.1).
I tested on the other iPhones like a iPhone 5 and iPhone 6s with same app, same iOS version.
It's not shown when app is in foreground as normal.
Push banner appears only on iPhone 7.
Is this normal?
My app is created by Xamarin.forms. (For now, Xamarin convert c# code to objective C, so it's basically objective c)
Thanks.
Starting with iOS 10 developers can control how notifications are shown when the app is in focus. This is done by setting up a UNUserNotificationCenterDelegate.
The userNotificationCenter:willPresentNotification:withCompletionHandler: will be fired on this delegate where UNNotificationPresentationOptions can be passed to the completionHandler to determine if the notification should be displayed along with its sound and badge value update.
Based on your question it sounds like you are using a SDK or framework to add notifications. You can still use a UNUserNotificationCenterDelegate along with most notification SDKs.
Note that on iOS 9 and older devices this delegate isn't available and notifications will not show in the notification center when they are received while your app is in focus. Instead you must must still use UIApplicationDelegate for older versions of iOS and show an in app message for them.
If an application is upgraded to iOS10, and developers of their app have used the UserNotifications framework.Then there are functions by which notification can be displayed as a native banner when app is in foreground.
The UNNotificationPresentationOptions flags allow you to specify UNNotificationPresentationOptionAlert to display an alert using the text provided by the notification.
It effect will same if you are using iOS10 , and app is compatible with UserNotifications framework.
As you mentioned, you have tested the app with Other device with same version, Then might be their app's latest version is not installed on those devices.
It is not based on iPhone7 only. That will work when iOS10 is
installed in your device and application is using UserNotifications
framework for handling the notification.

Can we send a message from iwatch to Iphone when iphone in sleep mode?

I am new to Apple Watch i am tried to Communicate From Apple watch to Iphone when Iphone is in sleep mode because i have to get some information from my Iphone application when i click on the notification on my apple watch.
we tried this links but these links are not working for me.
Can I keep my WatchKit App running in the background on the Apple Watch?
http://techotopia.com/index.php/A_watchOS_2_WatchConnectivity_Messaging_Tutorial
How can I awake my iPhone app in the background to run a function and return the results to Apple Watch?
Please help me.

open iPhone in foreground from the watch os2

Is there any way to bring iPhone application into the foreground by pressing a button in the Apple watch
any way other than handoffs!
No, it is not currently possible. WatchConnectivity just serves to exchange data between the two devices, not for changing their statuses.
Of course you may activate a local notification from the watch on the iPhone upon clicking which the coupled application goes to the foreground, but it shall still require an action by the user on the iPhone.

how to trigger notification from iPhone on iWatch

A noob question. I want to receive a notification when variable changes on the iOS app. to be clear. I want show notification on iWatch app when for example the user presses a button on the iOS App.
I have seen many tutorials for using the notifications interface. but all of them doesn't specify how to trigger the notifications from iPhone.
Anyone who knows a proper guide?
Thank you
Your notifications will go to your iPhone or your Apple Watch, depending on the device that you're using.
iOS will take care of notifications if your ios app supports notifications.
If your iPhone is unlocked, you get notifications on your iPhone, instead of your Apple Watch.
If your iPhone is locked or asleep, and your Apple Watch is unlocked and on your wrist, you get notifications on your Apple Watch.

Resources