Using Scheduled Task Agent with Periodic Task local notification at a particular time in WP8 - windows-phone-7

Using Scheduled Task Agent with Periodic Task in Windows Phone 8 how do i show the local notification at a particular time. For example at (9AM and 5 PM) every day?

You can't as it's impossible to schedule it for any specific time frame. From the MSDN documentation:
Periodic agents typically run every 30 minutes. To optimize battery life, periodic agents may be run in alignment with other background processes and therefore the execution time may drift by up to 10 minutes.
Other options available if you need that level of precision are
1) Programmatically set a reminder for the specific time that you want.
2) Push notifications from an external service to subscribed devices at your specified interval. Bear in mind that Push notifications delivery is slightly unreliable on windows phone.

Related

Wake app an asleep heroku app so the scheduler can run and let it sleep again

Heroku automatically sleeps the application afrer some time in the low price tiers which is a nice thing as it reduces the cost. But in a spring boot appllication the schedulers wont run when in sleep. Does heroru offer functionality to the wake-up the app so the schedulers will run?
Pinging every 30 minutes to have the app up and running does not suffice because the app will stay up even if it is idle. I would like to somehow wake up the app before a scheduler is about to run and then let is sleep back again if it is not used until a scheduler have to run again (or someone calls the api)
Your best bet is to move your job scheduling out of the main application. That way it doesn't have to be awake for jobs to run.
One way to do that is via the Heroku Scheduler:
Scheduler is a free add-on for running jobs on your app at scheduled time intervals, much like cron in a traditional server environment
Essentially, you can add jobs by providing a command to run and a frequency. The scheduler will kick the job off at the desired time.
Timing isn't guaranteed to be perfect, and very occasionally jobs may not run at all. But this is the most affordable option, and it has worked well for me in the past. For more precise and guaranteed timing you need to run at least one dyno continuously.

Is there a better way than brute force to maintain hub state? (Smart Home Group API)

Is there a better way to maintain hub state sync than periodic random checks? The physical remote gets a notification nearly instantaneously of a state change on the hub so I assume it's subscribed somehow to push-updates. Is the best approach to just send a GET request for the hub state every 30 seconds to a minute while idle, and every 5-10 seconds after an activity change? I don't want to bombard the servers with lots of requests but I'm not sure how to know when to unlock the UI after a successful activity initiation.
The current Smart Home Group API does not provide notifications of Activity or device state changes. This is something Logitech expects to implement later this calendar year.

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.

Keep agent active in windows phone

I want a service to be active always in the background. Is this possible in the new SDK 7.1
I read through the Background File Transfers, Agents, and Alarms. I think these are only active for a period of time.
Short answer: you can't
Background agents can only run for 15 seconds every ~30 minutes. Attempting to run for longer will result in the agent being terminated and not rescheduled. Riho is referring to something different: if the user does not run the owner application for 14 days your agent won't be rescheduled (even if it's successful); the application must be run and reschedule the agent.
Your only real choice is to move the functionality to the server and use push notifications to update the phone.
Agent gets deactivated after 14 days. Within that time you must make user to open your foreground application - then you can restart the agent and 14 days counter again.

Resources