Hola, estoy realizando una app y necesito obtener las coordenadas gps del teléfono, he visto varios tutoriales y lo que hacen es lo siguiente:
Pero a mi no me lee las coordenadas del teléfono, siempre salen a 0. ¿Alguien me puede ayudar?.
Muchas gracias.
Un saludo.
Input.location.Start ();//inicializa el input de localización
// Input.location.Start() method has a default distance value to be updated. by default it has 10m, thus you need to walk 10m to see the changes. Change those values at the moment of initialitation.
// Input.location.Start(10,0.1f); // accuracy, every 0.1m
latitud = Input.location.lastData.latitude;//latitud del dispositivo
//float latitud = 39.366922f;
yield return latitud;
longitud = Input.location.lastData.longitude;//longitud del disp.
//float longitud = -0.462656f;
yield return longitud;
//Parámetros: https://developers.google.com/maps/documentation/static-maps/intro?hl=es-419#Paths
urlMap= "https://maps.google.com/maps/api/staticmap?center="+latitud+","+longitud+"&markers=color:red%7Clabel:S%"+latitud+","+longitud+"&zoom="+zoom+"&size=512x512"+"&maptype=roadmap&markers=color:red%|label:|"+latitud+","+longitud+"&type=road&sensor=true?a.jpg";
WWW www = new WWW(urlMap);//Request a la www
yield return www;
imageMap.texture = www.texture;//textura de la imagen del mapa
latitudText.text = ""+ latitud;
longitudText.text = "" + longitud;
Pero a mi no me lee las coordenadas del teléfono, siempre salen a 0. ¿Alguien me puede ayudar?.
Muchas gracias.
Un saludo.