Пример #1
0
        public override bool StartUpdatingLocation()
        {
            bool isStartedOk = false;
            if (unityLocation == null) {
                unityLocation = new UnityLocation ();
            }
            if (unityHeading == null) {
                unityHeading = new UnityHeading ();
            }

            if (CLLocationManager.LocationServicesEnabled) {
                try {
                    LocationManagerSetup();
                    locationManager.StartUpdatingLocation ();
                    isStartedOk = true;
                } catch (Exception) {
                    isStartedOk = false;
                }
            } else {
                #if DEBUG
                SystemLogger.Log (SystemLogger.Module.PLATFORM, "StartUpdatingLocation(): Not Supported: LocationServicesEnabled = false");
                #endif
                isStartedOk = false;
            }

            return isStartedOk;
        }
Пример #2
0
 /// <summary>
 /// Keep a reference to UnityLocation, UnityHeading and UnityGeoDecoder so that we can access the different location, heading and geodecoder attributes.
 /// </summary>
 public UnityLocationManagerDelegate(UnityLocation unityLoc, UnityHeading unityHead, GeoDecoderAttributes geoDecoderAttributes)
     : base()
 {
     unityLocation = unityLoc;
     unityHeading = unityHead;
     geoDecAttributes = geoDecoderAttributes;
 }
Пример #3
0
 public override bool StartUpdatingHeading()
 {
     bool isStartedOk = false;
     if (unityLocation == null) {
         unityLocation = new UnityLocation ();
     }
     if (unityHeading == null) {
         unityHeading = new UnityHeading ();
     }
     if (CLLocationManager.HeadingAvailable) {
         try {
             LocationManagerSetup();
             locationManager.StartUpdatingHeading ();
             isStartedOk = true;
         } catch (Exception) {
             isStartedOk = false;
         }
     } else {
         SystemLogger.Log (SystemLogger.Module.PLATFORM, "StartUpdatingheading(): Not Supported: HeadingAvailable = false");
         isStartedOk = false;
     }
     return isStartedOk;
 }
Пример #4
0
        public override bool StartUpdatingLocation()
        {
            bool isStartedOk = false;
            if (unityLocation == null) {
                unityLocation = new UnityLocation ();
            }
            if (unityHeading == null) {
                unityHeading = new UnityHeading ();
            }

            if (CLLocationManager.LocationServicesEnabled) {
                try {
                    LocationManagerSetup();

                    if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) {
                        #if DEBUG
                        SystemLogger.Log (SystemLogger.Module.PLATFORM, "Using new iOS 8 Location Services Authorization");
                        #endif
                        locationManager.RequestWhenInUseAuthorization();  //only requests for authorization in app running (foreground)
                    }

                    locationManager.StartUpdatingLocation ();
                    isStartedOk = true;
                } catch (Exception) {
                    isStartedOk = false;
                }
            } else {
                #if DEBUG
                SystemLogger.Log (SystemLogger.Module.PLATFORM, "StartUpdatingLocation(): Not Supported: LocationServicesEnabled = false");
                #endif
                isStartedOk = false;
            }

            return isStartedOk;
        }