So far, to turn on and off the GPS device in Wp7, I do it in Settings Menu. Wonder If this can be done in code?
Thanks
---------- Update
Sorry for the confusion. Instead of turning GPS on and off, What I really mean is how to turn on and off the LOCATION in the Settings Menu of Wp7.
You can get the GPS data but you are not able to turn the sensor on or off via your application.
The most you can do in your application is start the geolocation data acquisition and stop it.
Windows Phone 7 apps should not change global settings for the phone.
You should have your own settings page in your app, with it's own toggle for whether or not your app should use the location data.
Then you check your setting before you access the location data.
Why would you want to turn it off globally?
Related
Since, I am new to Windows Phone technology ,so I want to detect touch event of Windows phone screen that means if I have touched on any screen on Windows Phone not necessary in application only outside of application (like start screen,settings screen) so can I get that touch event or any pixel information regarding that touch.Any help would be greatly appreciated .
Thanks you.
To protect the privacy of the user, there is no way to globally hook all touch events from an application. You can only react to events within your application.
Further, an application cannot access the screen while other applications are active. That would be a significant privacy hole if an application could record the actions of other applications.
I am developing a windows phone app that uses users current location, I am making the app in 7 OS. My question is, Can I track the location in background, that is when the screen is locked?
I know this is a possibility in wp8 as it provides us with GeoLocator class, but can I achieve this in wp7? I am basically making a runtracker app hence I would like my app to track the location even when its in background, is it really feasible?
Your help is always appreciated!!
It is possible to keep the app running under lock screen, as it does, for example, Endomondo app.
Using Idle Detection, you can keep the app on, although screen is locked, and you can keep on tracking the location. Actually, it is not running in background, but in the foreground. Just the screen is locked. So, be careful not to drain user's battery.
You have to set the PhoneApplicationService.ApplicationIdleDetectionMode property to Disabled, for example in InitializePhoneApplication() method in App.xaml.cs:
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
Note that there are special certification requirements for this type of apps. Refer to section 6.3 (Apps running under a locked screen) of the following page:
Additional requirements for specific app types for Windows Phone
I got the same problem in one on my apps..
I don't think it' s feasible for wp7..
Bt if you want to do it with wp8 you can refer following link.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681691%28v=vs.105%29.aspx
And to know about background supported and unsupported API's http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202942%28v=vs.105%29.aspx/css
GeoCoordinateWatcher Class exists in WP7, but here is the documentation from MSDN -
This API, used for obtaining the geographic coordinates of the device,
is supported for use in background agents, but it uses a cached
location value instead of real-time data. The cached location value is
updated by the device every 15 minutes.
More Info : http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202962%28v=vs.105%29.aspx/css
When the Windows Phone's system tray is visible, it could be in two states partially: battery + time or full (if all data are shown). I would like to know in my application that the state is changed. Has anybody an idea how it can be done?
Using the current version of the Windows Phone SDK, you can't really do this...
Is there any way switch on/off flight mode programmatically in Windows Phone 7.5. What I want to do is create background task which will be check time and switch on/off flight mode.
Thanks in advance.
No, this functionality is not available.
It was a design principle behind the platform that applications should not be able to do things without the user knowing it.
If such functionality was available then it would be possible for an app (either deliberately or accidentally-though a bug) to get the devices state in a setting other than what they user may expect. In such a scenario users will typically blaim the phone/platform for what has happened, not a misbehaving application.
Though you cannot programatically do it (as others have mentioned), you can send the user directly to the proper page in the settings panel and allow them to do it. Here's an example of using the ConnectionsSettingsTask:
http://msdn.microsoft.com/en-us/library/hh394011(v=VS.92).aspx
You would want to set the ConnectionSettingsType property:
http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.connectionsettingstask.connectionsettingstype(v=VS.92).aspx
To 'AirplaneMode'.
I am developing a GPS application and during startup I want to check if the GPS is active - if not I want to enable it. How can I do this?
Your application cannot control the status of the GPS.
You can, however, start and stop data acquisition.
Look into System.Device.Location