Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

c# - Location tracking windows 8

Im working on a reminder which also supports location-based reminders (eg when you get near your house it tells you to switch off the alarm for example)..

I need the app to check the location lets say every 2 minutes (so it doesnt drain the battery too much).

What technology should I use? I was thinking about toast notifications but this is to remind the user the he is approaching the location, but there needs to be a background task which checks the location even if the app is not running?

Are there any other technologies apart from background tasks that I should consider?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since you appear to be new, I will shoot you some good info:

First, frequency.

A Windows 8 Background Task can be triggered based on time. However, the minimum time supported is 15 minutes. This means your background timer could not update anything at a frequency less than 15 minutes.

Although lower times are supported, and although your Background Task will execute at that set time, any time set lower than 15 minute will not repeat. It is a run once and done operation. This is a common problem for developers who don't know the 15 minute rule.

You might want to read this: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/9622daff-4cf7-4cb9-9f78-251ac4287cde

Second, first use, approval

The first call to start using the device must be made on the UI thread so that the consent prompt can be shown to the user. If the consent prompt can’t be shown, the user can’t grant device access to the app.

cite: http://msdn.microsoft.com/en-us/library/windows/apps/hh768223.aspx

Third, background behavior (just so you know)

Read this:

If a Windows Store app for Windows 8 doesn't have focus, it won't receive location update events while it's suspended in the background. If your application tracks location updates by logging them, be aware of this. When the app regains focus, it receives only new events. It does not get any updates that occurred when it was inactive.

cite: http://msdn.microsoft.com/en-us/library/windows/apps/hh465148.aspx

More Background Task info: http://go.microsoft.com/fwlink/?LinkID=227329&clcid=0x409

And here: http://blog.jerrynixon.com/2012/08/windows-8-scheduled-tasks-lock-screen.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...