My Apple Watch never receives local notification send by the hosting iOS app - uilocalnotification

I intend to use the code below to send a notification from hosing iOS app to Apple Watch app
var localNotification = UILocalNotification()
localNotification.fireDate = NSDate()
localNotification.alertBody = ""
localNotification.alertAction = ""
localNotification.category = "GameStart"
localNotification.userInfo = payload.toDictionary() as [NSObject : AnyObject]
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
according to https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/BasicSupport.html, the Watch App should receive the notification under certain circumstances, I tried
- lock the screen
- put iOS app into background
But the Watch App never receive any notifications from iOS app.

I've managed to successfully receive UILocalNotification on Watch running WatchOS2. Make sure option 'Mirror iPhone Alerts from' is turned on for your app (it's a setting inside Watch(MyWatch) app on iPhone), your iPhone app is not running, iPhone is asleep and locked and the watch is on your wrist.

Related

Xamarin Forms Push notifications not received properly when the app is closed in android

We have configured push notifications in our Xamarin Application for both android and iOS. In iOS notifications are being received properly. But in Android, specifically when the app is closed the notifications are not being received properly.
When the app is open, push notification is triggered and displayed properly as expected, can be observed in the screenshot attached.
When the app is closed, push notification is triggered and displayed as "body", can be observed in the screenshot attached.
Note* Notifications are being sent from ASP.net core with Azure Notifications hub.
The payload looks like below : new JObject(new JProperty("notification", pushMessage)).ToString(Formatting.None);
Andoid Notifications
I tried changing notification payload in different ways but still result didn't change.

first app showing unread notification count from second app

Notifications from a previous app are being shown on the other app.
I have re-installed the app on multiple devices. If i send the notification out for one app then the unread notifications count of the other app are being displayed in the first app.
both apps are setup as different firebase projects.

Using Swift 2 won't allow iOS 8 devices to Register for Push Notifications

I am configuring push notifications on for iOS using Xcode 7 and Parse. The notifications are working perfectly on a device running iOS 9.
But when running the application on a device with iOS 8, I am running into problems. I am unable to get the Alert View where the user can select to "Allow Notifications from App X".
But, the device token registration call is being called successfully when the user opts in to push notifications and the device is successfully registering an Installation object with a valid device token. Notifications are also being sent to the device.
If I go into Settings->Notifications->My App and turn the Notifications On or Off, it doesnt make a difference the notifications are still being sent through.
This is the code I am using to register for notifications:
let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType([.Alert, .Badge, .Sound]), categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
Found the solution here on stackoverflow... Registration for notifications are sent only once on devices running versions older than iOS 9.
As answered by another user here...
"The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day."
OR
"If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by setting the system clock forward a day or more, turning the device off completely, then turning the device back on."
Reference Links:
Push Notification ON or OFF Checking in iOS
https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42

How to get app message from companion app if Pebble app is in background?

"I am explaining whole scenarios here in order to avoid multiple discussion threads, as I am looking for quick help, so providing here all the details."
I have created a application which communicates with the android companion app, which has some of events scheduled and needs to send to pebble app, so that even if the timeline is muted for our app we can provide important information to pebble app user.
I am able to get the data from companion app and process it successfully only if the pebble app is open but my one more requirement is :
To get data in pebble app sent by companion app, even if my pebble app is in background.
ie. If the companion app sends me some message but the pebble app is in background so I should be able to read that message and wake up the Pebble app to show the desired information.
I am using "App Message" for communication between Companion app and Pebble app.
I gone through the Pebble Documentation which states :
"Background workers do not have access to the UI APIs, they also cannot use theAppMessage API or load resources. Most other APIs are available includingAccelerometerService, CompassService, DataLogging and Storage."
One more Query is :
As we can get notification in our Pebble if its came to Phone, so is there any way to open some desired app or related app to that message in Pebble watch.
Please guide me if there is anyway to get this done.
Thanks in advance.
Your Android application can launch the watchapp before sending the message to her. That should solve your problem.
As indicated in the documentation, the background worker on the watch cannot receive app messages.

iPhone push notification unable in reading notification

The apple device showing me notification but when i open it , its batch number does not gets clear from device please help.
Use [UIApplication sharedApplication].applicationIconBadgeNumber = 0; in your UIApplicationDelegate.didFinishLaunchingWithOptions or UIApplicationDelegate.didReceiveRemoteNotification.
If you need reset application icon badge number from server, set badge value to 0 in APN message.

Resources