Windows Universal Platform: Background task to check email - windows

I want to develop an app that has a background task that checks email servers (POP, IMAP, etc) for new email.
From what I can tell of background task, it is only allowed to run for a short time, and can be started only every 15 minutes if it is a timertrigger.
Since I want this app to run on all Windows devices, what is that proper approach to having a background task that can do this? It doesn't seem possible at this point.
But since Windows devices are able to check email in the background, there must be a way. Does anyone have any insights?

What you wish to achieve is a near real time notification of user about a mail he received . You are right that Windows doesn't allow a background task to run at intervals lesser than 15 minutes . What you are looking for is Windows Push Notification Service which can be used to send notifications from your own cloud service onto the device

It is not possible to use a background task working all time to get in real time the new emails in your case.
You must implement another approach may be using your own backend to implement push notifications to send a new notification when a new email is received.
If your provider has an API you can use it.

Related

Windows Phone Background Application Service

In my windows phone 8 application, I would like to refresh/load some data periodically (less than 10 minutes) from server, while application running in background (ie, in dormant and tombstoned). I tried scheduled task agent and resource intensive task agent, but they are called at rate of 30 minutes gap. Please let me know is there any other solution for implementing the above said requirement.
Thanks and Regards
#nish
If you need to get data more frequently than the default available in Windows Phone, you should think about using push notifications. This won't be suitable for a full data push, but if you use it correctly, you can get a user experience that you can live with.
One common approach to this is to set up your server to send a notification to the device when there is something new to report instead of pushing a "nothing has changed" message every 10 minutes or so. If you push out a tile update notification to say, for example, "You have x unread items", the user may then click on the tile for your app and you can poll the server for new items on launch/resume. If you want a more intrusive option, you can send a toast notification as well, but in most cases the tile update will be sufficient.
This method has a few advantages.
You won't be burning through battery power polling every 10 minutes while the user is asleep
Your server will have significantly less load since it is not having to process full data requests every 10 minutes per client.
This fits in with the design philosophy of Phone apps - you are surfacing the required data to the user, while at the same time preserving battery life.
Do I understand correctly that your primary goal is to keep some host session alive by having the phone make a query periodically? If so...
I would not recommend this approach: 1) you cannot count on the phone having network connectivity when it tries to send its query. If the user puts the phone away in a pocket or purse, the odds worsen. 2) it's probably bad from a security perspective, and wasteful from a host resources perspective.
You might instead add logic to your app to resume a timed-out host session as seamlessly as possible. This would add real utility value to the mobile app value proposition over raw HTTP access to the same host.

Running Windows phone 7 app in background

I want a part(Service) in my windows phone app to run periodically.Actually its a server request , which should be made periodically and show any changes to user as notification
You should use the PeriodicTask which runs every 30 minutes in the background unless the user has not forbidden that. Notify the user about changes with a ShellToast or think about Push Notifications.
Important: Please keep in mind, that you can never rely on background tasks in Windows Phone. There are many reasons why such a task will not run. So do not outsource necessary or important work to it.

Windows Phone 7 background service

Can a background service be created in WP7 which uses GeoCoordinateWatcher to send data at a specific interval given. What I need exactly is to develop a lightweight WP7 background service that sends latitude and longititude to a wcf server after given MovementThreshold is passed. From what I read, this is not totally achievable in WP7. Is there any workaround that can help me?
It's possible to do a service which does this every 30 minutes - http://msdn.microsoft.com/en-us/library/hh202941(v=VS.92).aspx
But if you need more frequent access than that, then the only current possibility is for the user to run your app under their lockscreen.

background process and UI interaction

I am working on an application that is receiving XMPP notifications using the Matrix SDK. As well I am using async web service calls to receive an initial set of data from the server.
Now, I am aware that with Mango I can close the app or move it to the background and have a background task that is able to be run every 30 mins (or so) for 15sec max which obviosuly means the XMPP push isn't going to work in this scenario. Is there any way to get background apps to execute more frequently than this?
Failing that for the syncing process all I can do is every 30 mins use a web service call to get any updates and store into Isolated storage for my app to pick up when it's next run. But I believe I cannot use any UI from a background task so cannot tell the user of updates?
So, if I get an important message can I somehow override the slowness here and force my app to run and inform the user visibly that something has happened and he needs to look at it? Is this where push notifications come in?
You can use the ShellTile API to update the application's tile on the Start screen, or use the ShellToast API to show a toast to the user. Both of these can be configured to launch into a specific part of your application (deep-linking) when tapped.
If you need a constant monitoring/update/notification system for your application when it's not running, then using push notifications is probably the more appropriate approach.

Make Call and send SMS from Windows Phone 7 background app

Can I have some pointers on how can my "background app" make a call and send sms at some pre-defined number and predefined datetime.
This is not possible.
Windows Phone 7 does not support apps running in the background.
If you wanted to make a call or send an SMS from your app (while it was running [in the foreground]) you will need to use the PhoneCallTask or SmsComposeTask, respectively.
Note that these tasks don't actually make the call or send the SMS but prompt the user to be able to do so. One of the design intents of the platform is that the phone can't do something the user might not want it to, without the user knowing.

Resources