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].
Related
I am developing a voip based phone call app specially for video conferencing type calls. Everything works via normal push notifications.
how do I show incoming call screen with sound e.g.
I am trying to implement - https://developer.android.com/guide/topics/connectivity/telecom/selfManaged
not sure if I am in the right direction.
Note: I don't want to interrupt/intercept normal phone calls.
I have managed to implement this using combination of push notification, broadcast receiver, alarm service, setting window flags on activity with "FullScreenIntent".
"OnMessageReceived" set an alarm for x seconds (500ms) with Broadcast receiver
in receiver setup MainActivity intent and set flags "NewTask" and "frombackground"
In MainActivity - override "OnNewIntent", set the window flags
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
Window.AddFlags(WindowManagerFlags.DismissKeyguard);
Window.AddFlags(WindowManagerFlags.ShowWhenLocked);
Window.AddFlags(WindowManagerFlags.TurnScreenOn);
Window.AddFlags(WindowManagerFlags.Fullscreen);
this will open the app in fullscreen and can be routed to appropriate page for custom UI
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.
My WP7 app needs to handle different types of push notification. Some of these are only relevant when the app is running but one type serves as a prompt to the user to start the app as well as needing to be handled while the app is running. Hence, when opening the push channel, my code calls BindToShellToast and registers event handlers for when both raw and toast notifications are received:
if (!_pushChannel.IsShellToastBound)
{
_pushChannel.BindToShellToast();
}
_pushChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(pushChannel_HttpNotificationReceived);
_pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(pushChannel_ShellToastNotificationReceived);
Looking at the certification requirements, it appears that I have to provide a user setting to allow them to enable/disable not only push notifications in general, but also specifically toast notifications. See Additional requirements for specific app types for Windows Phone (requirement 6.2.1)
Since the user could potentially enable general push notifications but disable toast notifications, it seems to me that my server would need to send both a raw and a toast notification for the type that needs to be handled when the app is not running. This would make registering for the ShellToastNotificationReceived event pointless. Is my thinking correct here?
You should store a settings on your server for each registered device naming what type of notification the user allowed.
I'm testing out Windows Phone 7.5 push notifications. I have got the 3 different push types working fine (Toast, Tile and Raw) and am able to send messages from unit tests and a web application without any problems and receive them in my WP application. I want the ability to add extra properties to the push notification and the Raw push type does this perfectly for me and I can add custom key/value pairs or anything else to the push message and extract it on the phone app. I have just found out however that it only works if the application is running and my unit tests fail (suppressed notification status is received in unit test) when the phone application is not running (checked documentation which confirms this too). Is there anyway to add extra properties (key/values) to toast or tile messages or some way I can use raw in another way ? Toast notifications seem limited to a title property and an actual message property but I need to add additional data.
Just wondering if anyone had any suggestions / workarounds ?
The general practice I use is to initially send a raw notification to the device with phone-usable data embedded in the message. If my application is currently running then I can process the contents of the raw message and immediately make use of it on the phone. However if the application is not currently running on the phone you will receive notification from the push servers that the message could not be delievered. If I receive this response I send out a Toast / Tile notification.
With Toast notifications the only parametrisation you have access to is the URI that will launch the application. This is specified with the wp:param node of the message. Eg.
<wp:Notification xmlns:wp="WPNotification">
<wp:Toast>
<wp:Text1>Toast Title</wp:Text1>
<wp:Text2>Toast sub title</wp:Text2>
<wp:Param>/MainPage.xaml?LaunchedFrom=A%20Toast%20Notification</wp:Param>
</wp:Toast>
</wp:Notification>
If the user taps on this toast notification your application will launch and navigate to MainPage.xaml. You can access the querystring passed in via the NavigationContext.QueryString.
Note: The wp:Param node can only be sent to Mango (and up) devices. Additionally the entire contents must be less than 256 characters or you'll receive a PushErrorTypeMessageBadContent error. (Thanks to Ritch Melton for pointing this out). More info available from the Sending Push Notifications for Windows Phone page on MSDN.
As you've discovered, the Microsoft Push Notification Service is very strict in what types of messages you can send and receive. The intent of these push notifications is to provide simple push updates and not large amounts of data. The flexible Raw type seems like it would fit the bill until you discover that:
You can use a raw notification to send information to your application. If your application is not currently running, the raw notification is discarded on the Microsoft Push Notification Service and is not delivered to the device.
However, if you send a toast notification to your application, when the user clicks on the toast the application is started. When your application starts, you should check a service and retrieve the data you are trying to send from a web-service or other remote mechanism.
I have a toast notification system that is working on WP7. When I send a notification, all registered devices receive the toast notification.
But, If someone uninstall the application, I will continue to try to send to the registered device (in fact, I will ask Microsoft service to send to the unavailable device).
Is it possible to detect if someone uninstall the app, then I can remove it from my list of device to send.
Or maybe can Ms services tell me if the app as unsuscribe to the toast notification ?
My list of registered device grows infinitely ....
Thanks in advance for any Help,
Best regards
You can't detect if the user deleted the app, but can always check the subscription status return code when you send a notification!
Check here for the return codes, specifically where the SubscriptionStatus != Active