I would like to launch an application using parameters provided from a push notification on Windows Phone 8.
The behaviour I wish to achieve is that as soon as the user receives the notification, the application will be launched with the parameters provided in the notification. I.e. seamlessly present the notification in a more user friendly way.
As far as I understood there are three push notification mechanisms. Toasts, Tiles and Raw.
None of them seems to be able to handle the wanted behaviour.
Toast: The message is shown even if the application hasn't been started. It does not start the application unless clicked on but seems to be closest to the target.
Tile: Message is shown if the application has been pinned. But they may be difficult to notice unless the tile is pinned fairly high on the start screen.
Raw: Works in more power states but requires the application to be running. This doesn't seem to be a match because I want the notification to be received when the application is not running. I couldn't find information about which application states where raw notifications are handled. I would prefer all.
Did I miss something in my research? If anyone has a hint of how to put an application in the foreground from a push notification (without user interaction) it would be greatly appreciated!
My first attempt was to trigger the application start using SMS but that seems to be a no go.
See my post Launch application automatically from an SMS on Windows Phone 8
You can not automatically launch an application on Windows Phone (and neither can you on iOS or Android). What you can do is provide a URI with the Push notification so the user is taken to a page with the needed information
you can not put an application in the foreground from background without user interaction.
Related
I currently have a Windows Phone app that connects to a SignalR service to receive notification data. The service pushes data to the phone, which the app accepts, process etc and it’s all working as expected.
However, I would like the app to continue to receive the notification data when the app is suspended and no longer in the foreground, and display the notification data as a toast message.
From what I can see, the Background Task infrastructure offers no way to do this.
I have access to a Suspending and Resuming event (using Prism) so here I could Register/Unregister my background task.
For the trigger, the only one that comes close to being relevant is the TimeTrigger, but this only has a freshness time of 15 minutes, so assuming I am recreating the connection in the background task, I would end up opening and then instantly closing the connection every 15 minutes which isn't what I want to do.
I could have an “infinite await” that just hangs until a timeout, but this doesn't feel like the right way to go (and the resource usage would be terrible).
Is there a way around this to achieve what I want to do?
No, Windows Phone apps cannot keep a channel open like this. If the goal is only for toasts then you can do the computation on the server and push a toast notification.
Windows Store apps can do this with the ControlChannelTrigger class, but it is not supported on Windows Phone.
I have question about push notifications in Windows phone 8.
As i understand, there are three types of push notification:
Toast Notification.
Tile Notification.
Raw Notification.
So, in my opinion:
if the app is running, and opened in foreground:
Toast will be not shown, but i can handle it`s event and do something.
Tile will be updated automaticaly
Raw Notification must be handled by me. (Question one: can i do it without background task?)
if the app is running now, but suspended:
Toast will be shown as it came, without any event handling in my app, only "BindToToast()"
Tile Will be updated, without any event handling, only "BindToTile()"
Raw notification must be handled by background Task.
if the app is not open:
Toast will be shown automaticaly, if in previous launch "BindToToast()" was called.
Tile will update automaticaly, if in previous launch "BindToTile()" was called,
Question 2: what about raw notification? how to handle it here?
I think the situation is as follows:
Toast notification is shown only when the app is not running, but can be intercepted when it is
Tile notification always updates the tile regardless of application running
Raw notification can only be processed by the application when running.
Toast/raw notifications cannot normally be handled by a background task in Windows Phone 8.0. But there maybe a hack to get around this. See Windows Phone 8 notifications and background tasks and Windows Phone 8 Background Task with notifications
In Windows phone 8.1 it is quite possible to create a background task that is invoked when a notification is received, so the notification can be processed by the background task.
Is it possible to create an NFC message that will create a calendar entry on the destination phone, without requiring my app to be installed on the destination phone?
For the moment, I've implemented it by using a custom protocol URI, but I'd like this to work even when the destination phone does not have my app installed. It would be even better if it could work on an Android destination.
You cannot do this on any phone if I am not mistaken. NFC messages at the end of the day are just bytes being transferred from one mobile device to another. If the destination device does not know how (and most of them do NOT have a build in handler for calendar event) to parse that message in order to open a native application what you are trying to do will not work.
Even if you get an NFC reader and read an NFC message design for that purpose and then recreate this in your application it will NOT be universal; meaning it will not work on any device, especially on different OS devices.
Again this is what I know so far. Don't take this for granted.
Have you tried to store a vcalendar item on a tag to see whether/how a phone reacts to this?
text/x-vcalendar or text/calendar
might be the right format to use for the NDEF record. See also this so question.
If this would not work, you might write an app that takes intents from such calendar data and sends it to the calendar app on the phone (however I don't know how that step would work).
In Windows Phone, the reminder is usually used for scheduled notifications. The reminder when popped up, requires user to click the reminder pop up in order to navigate to specific page and do certain action.
Can we simulate or suppress this reminder programatically when occured and instead perform the action it was supposed to execute when actually clicked. This would be of great use to user.
Any help, suggestions or ideas on the same?.
Thanks In Advance.
It isn't possible. A Windows Phone application has very limited interaction with the system when it isn't running in the foreground.
If you're trying to bypass the reminder to display something (for instance, a page of your application) without user interaction, then you have no way of doing that.
If it's just about updating some data or calling a webservice without displaying anything, you should use a background agent instead of a reminder.
Windows Phone was built around the idea of letting the user in control at all time. That's why there is no way of forcing the user to navigate to a page of your application if it wasn't running in first place.
I made a little app for WP8 that would fetch notifications from Azure mobile service table (and it did). Then I added push to it. The app is identical to the sample app given on the Azure website. I even tried the sample one and the same thing happened: log shows toasts have been sent but my device doesn't receive any at all.
Also, I have done the same with WinJS app and it works flawlessly.
Last night, I tried it again and got toast on device just once out of nearly 20 requests.
I am clueless - if its the code that you are looking for it's right here http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-push-wp8/
Any help would be appreciated, thanks!
Were you running the application in the foreground on the phone at the time? Toasts don't show on WP8 if the app is in the foreground.