App crashed if run in background

kkolle

Member
Licensed User
Longtime User
Hi,
since i use new version 2.50, my app crashed if it run in background an i use the playstore or web browser. The problem is that my services can't be created.

Here is the Stack trace:

B4X:
java.lang.RuntimeException: Unable to create service com.mo.msm.gpsservice: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException


   at android.app.ActivityThread.handleCreateService(ActivityThread.java:2582)
   at android.app.ActivityThread.access$1600(ActivityThread.java:139)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1325)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:4945)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
   at com.mo.msm.gpsservice.onCreate(gpsservice.java:33)
   at android.app.ActivityThread.handleCreateService(ActivityThread.java:2560)


   ... 10 more
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.mo.msm.gpsservice.onCreate(gpsservice.java:31)
   ... 11 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
   at com.mo.msm.main.initializeProcessGlobals(main.java:1714)
   ... 14 more
Caused by: java.lang.NullPointerException
   at anywheresoftware.b4a.BA.<init>(BA.java:98)
   at com.mo.msm.cstops.innerInitialize(cstops.java:12)
   at com.mo.msm.cstops._initialize(cstops.java:290)
   at com.mo.msm.main._process_globals(main.java:2191)
   at com.mo.msm.main.initializeProcessGlobals(main.java:1658)
   ... 14 more

I don't now why

Anybody an Idee?
 

kkolle

Member
Licensed User
Longtime User
Hi Erel,
thank you for your answer.

Here is the code for my GPS service:

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim GPSCounter As Int
   
   Dim myGPS As GPS
   Dim mySatellitesList As List
   Dim mySatellitesListAvailable As Boolean
   
   Type NMEAData(latitude As Int, longitude As Int, speed As Int, direction As Int, validAccuracy As Boolean, utcDate As String, utcTime As String, satellites As Int, status As Int, altitude As Int)
   Dim GPSData As NMEAData
   GPSData.status = 0
   
   Dim GPSLogCounter As Int
   GPSLogCounter = 0
   
   Dim VehicleStopped As Boolean
   
   Dim myGPSEnabled As Boolean
   Dim myGPSStopped As Boolean

   Dim LastGPSEnabledState As Boolean
   LastGPSEnabledState = False
   
'   Dim myWifi As ABWifi
'   Dim wifiLoad As Boolean
'   Dim LastWiFiLongitude As Int
'   Dim LastWifiLatitude As Int
End Sub

Sub Service_Create
   myGPS.Initialize("GPS")

End Sub

Is something wrong in a part of Process_Globals ?
 
Upvote 0
Top