I am working on developing a non-VoIP Windows Phone application that needs to have a background HTTP connection to be notified when new messages are received. I noticed for Windows Store apps, there is an example for ControlChannelTrigger that allows you to connect an HttpRequestMessage and will send a push notification to the app when data is returned by the http request.
Is there a similar concept that I can use for Windows Phone, because just using a Periodic Task really isn't good enough.
You cannot do that with Windows Phone. Once your app is not on the foreground anymore, there is no way for it to maintain a connection.
You should instead look into push notifications implementation here.
There was a trick where you could use a background audio agent to maintain the connection but I don't think it's still doable. And is considered a very bad practice from both a developer and a user points of view.
So you should just go with the standard push notification thing linked above.
Related
I understand that there needs to be a way to LISTEN for incoming notifications to my app, but I'm not sure where to begin to set that up. Can I at least get a starting point from someone with experience setting this up. There does not seem to be any documentation available anywhere. Thanks
No matter how you push the notification to your UWP app clients, the underlying principle is based on WNS. Then, whether you use Google Drive API or some other ways, the notifications are the same in UWP.
So, you could use UWP APIs to listen when the notifications are received. For example, you could use Notification listener.
In general, we setup a background task with UserNotificationChangedTrigger to enable an app to listen to notifications.
I'm creating a xamarin.forms application and have got most of the app completed. My only hickup is push notifications. I'm sending my notifications to the app using SignalR and a .Net Web API Server. I'm able to receive notifications while the app is running however, I can't see tutorials for push notifications while the app is asleep. I've checked out services as well. Thank you for you help in advance.
SignalR is not a push notification and there is a difference between them.The main difference is that in case of SignalR you have to keep an opened connection to your hub in order to receive events / signals. So if you want to receive notifications while the app is killed or in background SignalR is a wrong solution since it is technically impossible to keep your application always running on a mobile device. However, push notification can awake your application when it is killed or in background.
I would suggest to rethink your current solution instead of looking for hacks.
I'm relatively new to Android app development and Xamarin.Forms development in general, so I'm looking for an advice on what is the best way to implement the following:
When active, my app downloads data using a simple REST appi service (I'm using a HttpClient for this). Now what I want is when the app is closed, to still check if some data is changed on the server, using the same method as it was used when the app is running, and if so, to fire up the notification to the user.
I've been reading about the services, and that seems like a solution to my problems, but what I need to know is: what kind of service is most suitable for this task? Is it a Bound service, Intent service or Started service? Or is there a way to achieve this without the use of the service?
azure notification hubs sends to apple and google play
Our desktop application require to be updated directly when a mobile employee sends any message from his/her windows phone 7 mobile.
Currently our requirement is that send a message from our desktop application to a Windows Phone 7.5 which we are able to achive easily using PUSH Notifications, Now when the user takes some action against the sent message the windows phone app calls the WCF service and pass the message to that WCF which receives the message and puts into the database and application reads it later and this is where problem lies. Because our WCF is putting that message into database our application is polling it every 5 second and if any replies received from any of our drivers then it is updating the UI.
What we want to achieve is when we receive any reply our desktop applicaton should be notified automatically and udpates the UI and then put it into the database.
So please share your experience on this issue.
Thanks
Why not update the WCF service to notify any registered "listeners" (i.e. running instances of your client app) that the database has been updated with new information?
You could do this by having your service expose a service that can be called by clients wanting to register for some/all event types. The client app(s) host a service implementing a callback contract that the service can call when the registered events are raised.
There's a good MSDN article one-way, callback and pub-sub messaging with WCF: http://msdn.microsoft.com/en-us/magazine/cc163537.aspx.
Be sure to keep track of and throttle how many events your client app is receiving per second - the last thing you want to have happen is for 100 client apps to all hit the server 50 times each if 50 events are raised sumultaneously!
Richard's solution is probably more proper, since it describes using nicely packaged WCF APIs that will do a lot for you. Another way could be to implement long-polling yourself. You could then also update your Windows Phone clients when they need to receive an immediate update. I wrote an article on that some time ago which you can find if you google long polling on Windows Phone.
please forgive me for this idiot question. I understood that we can send push notifications to windows phone 7.
Like, in our case we sent the Raw push notification to our application running on Windows Phone 7 and based on that notification the application did some work. Now after that the user did some action which is suppose to communicate back to our main Winform application.
How can we achiver this functionality? How can we receive the notification back from Windows Phone 7 to .NET Winform application.
Can anybody share thier experience.
Thanks
Push notifications can only be sent TO a WP7 app.
If you want to call another app (on another machine/server) you'll have to make a HTTP (or socket) request from the WP7 app. If you want that to go to an app on a PC you'll need to route the message via a web endpoint. The format, sending and delivery of such messages are entirely up to you. There is no service currently available in the SDK to do this.
You could add a http based wcf service that your windows phone app can call. And let the wcf service push data to a message queue(MSMQ, RabbitMQ) which your window form will be listening to for response