I used this LocationManagerEx library to get my app working on a tablet that does not have GPS or 3G (but does have bluetooth).
I feed the real GPS co-ordinates in from another phone using a GPS to bluetooth app and then pick up those co-ordinates on the tablet using a bluetooth to GPS app which displays the latitude and longitude just fine.
My app runs and gets the latitude and longitude from the _LocationChanged callback. So everything is fine
Dim lmex As LocationManagerEx
lmex.Initialize("lm")
lmex.requestGPSLocation
Sub lm_locationchanged(Location1 As Location)
Log("imported Lat " & Location1.Latitude) ' this value supplied from other phone via the mock location mechanism
Log("imported Long " & Location1.Longitude)
Log("imported Alt " & Location1.Altitude)
End Sub
However, when I load the app on a device which supports GPS directly I want to use the standard GPS library and execute this code
Dim GPS1 As GPS
GPS1.Initialize("GPS")
GPS1.Start(2000,0)
Sub GPS_LocationChanged(Location1 As Location)
Log("GPS Lat " & Location1.Latitude)
Log("GPS Long " & Location1.Longitude)
Log("GPS Alt " & Location1.Altitude)
End Sub
but I get the following exception
java.lang.RuntimeException: java.lang.Exception: Sub gps_locationchanged signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:201)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at anywheresoftware.b4a.gps.GPS$1.onLocationChanged(GPS.java:65)
at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:279)
at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:208)
It seems that the LocationManagerEx library has 'taken over' the message handlers even though no LocationManagerEx object is instantiated in the case where the GPS b4a library is used.
It there a way around this problem? Currently I have to have two completely separate executables, one for a device with real GPS support and another if I need to use the 'mock' location library.