예제 #1
0
        private void Create(Position position)
        {
            // Set the thing
            GPS th = new GPS()
            {
                latitude    = position.Latitude,
                longitude   = position.Longitude,
                timestamp   = position.Timestamp.ToString("yyyy-MM-ddTHH:mm:ssZ"), //YYYY-MM-DDTHH:MM:SSZ
                heading     = position.Heading,
                speed       = position.Speed,
                accuracy    = position.Accuracy,
                altitude    = position.Altitude,
                altaccuracy = position.AltitudeAccuracy,
                battery     = RemainingChargePercent
            };

            try
            {
                // Create a new one
                databaseReference.Child(android_id + "/" + position.Timestamp.ToLocalTime().ToString("yyyyMMdd")).Push().SetValue(th.ModelToMap());//.AddOnCompleteListener(OnComplete).AddOnFailureListener(OnFailure);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                NotificationText(ex.Message, string.Empty);
            }
        }