Open Apple Maps by tapping on a WKInterfaceMap in a dynamic notification - apple-push-notifications

My Watch app receives push notifications containing location information and I use that info to show a WKInterfaceMap.
However, when I tap on the map in the notification dynamic interface, my app is opened instead of the Maps app.
I found this forum post stating:
There is no url to call at this time. The user tapping on a WKInterfaceMap object is the only way to launch the Maps app from yours.
Does anyone know why this does not work with WKInterfaceMap objects in a notification?

Since notifications are not interactive, it's not possible to trigger any object interaction in a dynamic notification. Tapping anywhere in the notification area will always launch your watch app.
This is briefly mentioned in the App Programming Guide, under Designing Your Dynamic Interface:
Tapping your notification interface launches the app, so notification interfaces should not contain interactive controls.

Related

Xamarin.Forms UI not responding

I'm working on a Xamarin.Forms app using the Prism library. The app has a phone component to it with integration to CallKit and a SIP library. When the device is locked, a call can be received, which results in the native phone UI for iOS. User can answer the call and hangup. Within the app, there is a Xamarin.Forms page to handle calls. There are events from the iOS service that deals with the calls to interact with the "shared project". The issue that I am running in to is that when the user unlocks the device and returns to the app, the UI is non-responsive.
Scenario:
User starts app and logs in.
User locks device
Incoming call received
User answers call
Behind the scenes (i.e. native phone UI), the call service communicates with the "shared project" to display a Call Screen in the app. Since the phone is locked, the user will not see this now.
User hangs up.
When user hangs up, the call service communicates with the "shared project" that the call has been terminated and to return to the previous screen.
User then unlocks the screen
App is on same screen as when user locked device, but UI is not responsive.
To navigate to the call page, I am doing:
await NavigationService.NavigateAsync(targetPage, null, useModalNavigation: null, animated: animated);
and to return to previous page:
await NavigationService.GoBackAsync(animated: false, parameters: parameters);
NavigationService is of type INavigationService from Prism.
The essential question is: what would make the navigation appear to work, but result in a non-responsive UI? I've found in the past that I need to do the navigation on the main thread. Is there anything else I need to look for?
What I understood that you are looking for a method just like the OnAppearing method of forms page.
You need to implement interface INavigatedAware to your ViewModel. By doing this, 2 methods will be added to your ViewModel "NavigatedTo" and "NavigatedFrom". You need to put your logic into the "NavigatedTo" method. This method will be triggered whenever that particular page will appear on the screen.

iOS 11 push notification banner now shown while app in foreground

In doing some testing on the iOS 11 preview, I've noticed that when I get push notifications while my app is foregrounded the OS displays the system notification that you normally only see when your app is not active.
I didn't see anything announced as having been changed, or any new APIs to change this behavior one way or another. Does anyone know or have links to documentation stating if this is intended, a bug, temporary, or what?
There's an option for showing Push Notifications in the foreground in UserNotification framework.
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
Quoting the comment from the Framework:
The method will be called on the delegate only if the application is in the foreground. If the method is not implemented or the handler is not called in a timely manner then the notification will not be presented. The application can choose to have the notification presented as a sound, badge, alert and/or in the notification list. This decision should be based on whether the information in the notification is otherwise visible to the user.
This could be the place to start looking for the answer.

Windows interactive notifications

So I want to know how a quickreply toast can be sent to the right person and when you click on it, it goes to the specific person.
Example 1:
Person A texts me, I pull down on the interactive notification and type my response and it gets processed by the background process. How does the applications know that my response goes to Person A. is there an attribute in the XML of the toast that can be a variable, like the phone number?
Example 2:
Person A posts a picture on my facebook, I click on the notification and it takes me to the page on facebook. Again is there an XML variable with a URL of it or something?
You can download this Microsoft Windows UWP sample, where you can see what code they use to manage notifications.
I think that you need Toast notifications:
Toast notifications are small pop ups that appear on the screen for few seconds. They convey messages and can be customized to even play different sounds. New to Windows 10 are actionable toasts where a user has a choice to interact with the notifications by use of a button, for example.

Can an app use both alerts and banners in Notification Center?

I am creating a Mac OS X application to use Notification Center. Some notifications should remain on the screen until the user interacts with them, and others should disappear shortly after displaying.
The NSUserNotificationAlertStyle key and changing System Preferences allow changing between banners and alerts. However, both approaches change all the notifications sent from my application.
Can I send some notifications as alerts and others as banners? If so, how?
NSUSerNotificationAlertStyle is the only way the developer can set the default notification style for the application, and it sets the style for all notifications from that app.
If you think it's really important for you to have 2 different kinds of notifications you can work around the problem by having a hidden helper application with a different NSUserNotificationAlertStyle than the main app.
Remember though you set the default notification style, but the user can change it whenever he wants in the notification center prefs, making your helper app useless.
No. The different notification types exist so that the user may select what he/she prefers, not so that the developer can.
If you feel your app should have this ability, you should file an enhancement request at http://bugreporter.apple.com and let Apple know.

Scanning notification through WIA

I've registered to receive WIA notifications for all devices through RegisterEventCallbackInterface for WIA_EVENT_DEVICE_CONNECTED and WIA_EVENT_SCAN_IMAGE events. However I only receive notifications when scanner device is plugged in - I don't receive notification when I scan (for example with mspaint which uses WIA). Am I supposed to receive scanning notifications from applications or only when Scan button is pressed on a device? (I haven't tried the latter since I use a multifunction printer without Scan button). Is there any other way to be notified about successful scans through WIA? Thank you.
The notification API will just tell you if the button has been pushed. You can register a temporary or permanent (i.e launch an app) handler. If you're trying to scan you need to use Item.Transfer() or CommonDialog.ShowTransfer() from device.Items[1].

Resources