0

I am trying to get latitude and longitude using GPSTracker class, it always returns 0.

I traced the code, it took me to the LocationManager java file, it shows three imports with Cannot resolve symbol errors. Please see the picture below.

By the way, in the GPSTracker class, this line:

location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

returns null, that's way I get 0 for latitude and longitude.

I can compile the code without any error.

much appreciated if someone could help.

Can not resolve symbol

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
cxc
  • 5
  • 2
  • The "GPS tracker" code has serious flaws which are discussed in [this blog post](http://gabesechansoftware.com/location-tracking/). Just choose some better example code (like from the [Documentation section](http://stackoverflow.com/documentation/android/1837/location#t=201609041208362023868) here at StackOverflow and you'll have less troubles. – Markus Kauppinen Sep 04 '16 at 12:11

1 Answers1

0

for the second problem - getting null in getLastKnownLocation

use this solution:

https://stackoverflow.com/a/20465781/6778400

Community
  • 1
  • 1