0

I'm trying to get the current location of the phone through GPS. I followed the tutorial on the Android Developer's pages (Location and Maps) and I downloaded some examples too.

I keep getting this error in LogCat, though:

GPS    [assist_gps_request_set_id][line = 1197] : Failed with INVALID SET-ID TYPE
GpsLocationProvider    Error getting cell location info.

How can I make this error go away and let my app work?

Michał Powaga
  • 22,561
  • 8
  • 51
  • 62
pimd
  • 105
  • 1
  • 6
  • 1
    show us please code how you do use `GpsLocationProvider` – Marek Sebera Dec 11 '11 at 11:56
  • I use the same code from the developer's pages. So I use the class LocationProvider: LocationProvider locationProvider = LocationManager.NETWORK_PROVIDER; Location lastKnownLocation = locationManager.getLastKnownLocation(locationProvider); – pimd Dec 11 '11 at 12:36
  • have you requested `ACCESS_FINE_LOCATION` and `ACCESS_COARSE_LOCATION` permission? – Marek Sebera Dec 11 '11 at 12:55
  • I didn't have the ACCESS_COARSE_LOCATION in the manifest. After I did this, the errors are still happening. – pimd Dec 11 '11 at 13:44

1 Answers1

1

With "Error getting cell location info." Android tells you that you don't have a valid GSM signal at the moment. This error happens if this results to false:

(gsm_cell != null) && (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) &&
                    (phone.getNetworkOperator() != null) &&
                        (phone.getNetworkOperator().length() > 3)

See here in function requestRefLocation(int flags): http://www.java2s.com/Open-Source/Android/android-core/platform-frameworks-base/com/android/server/location/GpsLocationProvider.java.htm

Have a read on the solution of this question to understand what A-GPS is and how it helps you to get a valid GPS signal: Get Latitude and Longitude without inserting Sim Card and Start/Stop Gps from Application

As for "Failed with INVALID SET-ID TYPE", you should check your program with another phone. Looks to me like you don't have a SIM-Card inserted.

Community
  • 1
  • 1
Anton Kaiser
  • 713
  • 6
  • 11