Created
July 13, 2010 21:09
-
-
Save Clancey/474532 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class AppDelegate : UIApplicationDelegate | |
{ | |
CLLocationManager _iPhoneLocationManager = null; | |
LocationDelegate _locationDelegate = null; | |
// This method is invoked when the application has loaded its UI and its ready to run | |
public override bool FinishedLaunching (UIApplication app, NSDictionary options) | |
{ | |
this._iPhoneLocationManager = new CLLocationManager (); | |
this._locationDelegate = new LocationDelegate (this); | |
this._iPhoneLocationManager.Delegate = this._locationDelegate; | |
this._iPhoneLocationManager.StartUpdatingLocation(); | |
this._iPhoneLocationManager.DesiredAccuracy = 150; | |
this._iPhoneLocationManager.DistanceFilter = 50; | |
return true; | |
} | |
void HandleLocationManagerUpdatedLocation (object sender, CLLocationUpdatedEventArgs e) | |
{ | |
} | |
// This method is required in iPhoneOS 3.0 | |
public override void OnActivated (UIApplication application) | |
{ | |
} | |
public override void DidEnterBackground (UIApplication application) | |
{ | |
_iPhoneLocationManager.StartMonitoringSignificantLocationChanges(); | |
Console.WriteLine("Entered BAckground"); | |
} | |
} | |
public class LocationDelegate : CLLocationManagerDelegate | |
{ | |
AppDelegate _app; | |
public LocationDelegate (AppDelegate app) : base() | |
{ | |
this._app = app; | |
} | |
//=============================== | |
public override void UpdatedLocation (CLLocationManager manager | |
, CLLocation newLocation, CLLocation oldLocation) | |
{ | |
Console.WriteLine(UIApplication.SharedApplication.ApplicationState + " : " + newLocation.HorizontalAccuracy + "," + newLocation.VerticalAccuracy + " : " + newLocation.Coordinate.Longitude.ToString () + "," + newLocation.Coordinate.Latitude.ToString(), DateTime.Now ); | |
} | |
//=============================== | |
//=============================== | |
public override void UpdatedHeading (CLLocationManager manager, CLHeading newHeading) | |
{ | |
} | |
//=============================== | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment