Ejemplo n.º 1
0
        public void LocationEquality()
        {
            var a1 = new LocationInfo(1, "a");
            var a2 = new LocationInfo(1, "a");
            var b1 = new LocationInfo(1, "b");

            Assert.True(a1.Equals(a2));
            Assert.False(a1.Equals(b1));
        }
        /// <summary>
        /// Retrieve the lastest location, without restarting locationService.
        /// </summary>
        /// <returns>Loc Object</returns>
        public static Loc RetrieveLocation()
        {
            LocationInfo locationInfo = Input.location.lastData;

            if (locationInfo.Equals(default(LocationInfo)) || !Input.location.isEnabledByUser || Input.location.status == LocationServiceStatus.Failed)
            {
                if (initLocationServiceException != null)
                {
                    throw initLocationServiceException;
                }
                else
                {
                    throw new LocationException("MobiledgeX: Location Service disabled by user.");
                }
            }
            Logger.Log("Location Info: [" + locationInfo.longitude + "," + locationInfo.latitude + "]");
            return(ConvertUnityLocationToDMELoc(locationInfo));
        }