Android Question What's causing this crash? (GPS)

App Dude

Active Member
Licensed User
Longtime User
This has been working fine, with GPS1.start(0, 0), but when I changed to GPS1.start(0, 1), I'm getting this crash occasionally...

b4xmainpage_gps_locationchanged (java line: 282)
java.lang.RuntimeException: Object should first be initialized (Location).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(
    at b4a.example.b4xmainpage._gps_locationchanged(
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(
    at anywheresoftware.b4a.BA.raiseEvent(
    at anywheresoftware.b4a.gps.GPS$1.onLocationChanged(
    at android.location.LocationManager$ListenerTransport._handleMessage(
    at android.location.LocationManager$ListenerTransport.access$000(
    at android.location.LocationManager$ListenerTransport$1.handleMessage(
    at android.os.Handler.dispatchMessage(
    at android.os.Looper.loop(
    at java.lang.reflect.Method.invoke(Native Method)
*** Service (starter) Create ***
** Service (starter) Start **

My GPS_LocationChanged function is in Main between lines 109 and 134, so not sure what "java line: 282" is pointing to. Some internal code, but I'm not sure how to correlate that to where/what in my code is causing this.