I developing application which using geo-location.
Should i ask user right for this when my application starts? If yes, how?
I found only one global setting for all application in Settings. But maybe user don’t trust my application this service, so what is best practices?
In accordance with the Application Certification Guidelines, http://msdn.microsoft.com/en-us/library/hh184841(v=vs.92).aspx, you must inform your user that you are using location services, allow them to opt in/out, and provide a way for them to disable location services in your app should they decide to.
The way I prompt is by using application settings, http://msdn.microsoft.com/en-us/library/cc221360%28v=vs.95%29.aspx, I check for a setting that it was first run or not. If first run, then the setting isn’t there, so it knows it is the first time the application is run. Then, I use a MessageBox, with OK/Cancel. If OK, then location services (another property in the settings class) is true, and the next time the app starts it knows it can use location settings. Once the messagebox has shown, then set FirstRun = false, so you’re not popping the messagebox every time the app runs. You are allowed to save the setting.
Each time your app is going to access location, it needs to check to see that location services have been allowed. You can do this by checking settings, by using a global variable, or whatever. I set a global variable when the app starts, by setting it equal to the property in settings. Then, if that setting is changed, the global variable is changed, so that if they’re running, and they decide to disable location services, the app will stop using them.