locked
Achieving (nearly) real time toasts RRS feed

  • Question

  • I'm trying to do something like the official Mail app and showing the user instant Toast notifications, by polling a Twitter feed.

    What would be the best way to achieve this?

    I've tried polling it every 1 minute with a simple Timer but this fails once the app is suspended.

    I've also considered Background tasks but these have a time limit of 15 minutes, and if I'm reading it right it might execute in 30 minute intervals if I'm unlucky, which is unacceptable in my case.

    EDIT: I forgot to mention that I've also thought of streaming but as far as I know that has the same problems as regular polling.
    • Edited by CrushyPedro Saturday, October 19, 2013 4:57 AM Additional Information
    Saturday, October 19, 2013 3:15 AM

Answers

All replies

  • You will need to push notifications from your server rather than polling from the client.

    As you note, you can't poll frequently from a background task.

    --Rob

    Saturday, October 19, 2013 7:00 AM
    Moderator
  • I was hoping for a solution that didn't involve setting up a server as this was meant to be a free app.

    I have found this in the meantime, which seems to indicate we can stream data directly from the twitter api without requiring a server.

    It sounds promising but for now I'm afraid it would be too much work to basically create a twitter library from scratch using sockets. I'll try to see if I can make do with with the "normal" timed background task.



    • Edited by CrushyPedro Saturday, October 19, 2013 7:52 AM
    Saturday, October 19, 2013 7:50 AM
  • you can look to mobile services for the notifications, as long you keep the traffic low it can be free.

    otherwise you have to go for background tasks, if you can plan the notifications a little ahead you can use ScheduledToastNotifications as well, you can plan them from a background task.


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Saturday, October 19, 2013 6:07 PM
  • Could you go into more details on these Mobile Services please? I'm not sure what type of services those are.
    Saturday, October 19, 2013 6:15 PM
  • see : http://weblogs.asp.net/scottgu/archive/2012/08/28/announcing-windows-azure-mobile-services.aspx

    there is some infrastructure for push notifications in that platform


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Marked as answer by CrushyPedro Saturday, October 19, 2013 8:39 PM
    Saturday, October 19, 2013 7:26 PM
  • I see, this might be the solution I was looking for. It also solves the problem of the twitter API limits. Thanks!
    Saturday, October 19, 2013 8:39 PM