- Home /
 
               Question by 
               hikigaya0202 · Mar 26, 2017 at 05:16 PM · 
                gps  
              
 
              Force Closed when using GPS
I've been trying different ways to use GPS function of unity . It's all up and working but the problem after a certain seconds it'll result to a force shutdown here's my simple code for the GPS.
 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 
 public class gps : MonoBehaviour
 {
     public Text singleText;
     public int x;
     private void Start()
     {
         // Turn on location services, if avialable
         Input.location.Start();
     }
 
     private void Update()
     {
         UpdateLocation();
     }
 
     private void UpdateLocation()
     {
         // Do nothing if location services are not available
         if (Input.location.isEnabledByUser)
         {
             float lat = Input.location.lastData.latitude;
             float lon = Input.location.lastData.longitude;
 
             
 
             singleText.text = "Depart lat: " + lat + " lon: " + lon;
         }else
         {
 
             x += 1;
             singleText.text = x.ToString();
         }
     }
 }
 
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Unity Android Inputs With Samsung Galaxy Ace 0 Answers
Why I can't get GPS information on Android device 0 Answers
How can i get gps signal on my andriod without data or wifi 0 Answers
GPS check current location with longitude and latitude of multiple locations in XML 0 Answers
GPS location on Android 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                