In my application, I have a class called SvcLocationTracking.bas with the following content:
When I run the apk, the app runs fine.
Now, when I restart the phone, it powers down as normal and resumes as normal except for a message that says, "Unfortunately, UKSM PhoneApp has stopped."
The error log displays the following:
The only part of this that I recognise is svclocationtracking.java, which was what alerted me as I presume it is the java counterpart of my SvcLocationTracking.bas service class.
As you can see from my code, my standard practice for trapping exceptions are within each function/method, and so the 'Exception/Error spew' above means little to me.
However, the part that sticks out to me is an InvocationTargetException, which I found some information on here: http://developer.android.com/reference/java/lang/reflect/InvocationTargetException.html
The reason the service code is so empty is due to at first thinking that it was my code that was causing the malfunction, so I reduced it down as far as it would go and still get the error.
Changing #StartAtBoot: True to #StartAtBoot: False stops the error, but this is no good as I need the service to run on start-up.
Any help will be appreciated.
B4X:
#StartAtBoot: True
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim GStrClass As String = "SvcLocationTracking"
Dim GBlnLoudExceptions As Boolean = True
End Sub
Sub Service_Create
Dim StrMethod As String = "Sub Service_Create"
Try
Catch
If GBlnLoudExceptions Then LogColor("Exception: " & LastException.Message & " - Class: " & GStrClass & " - Method: " & StrMethod, Colors.Magenta)
End Try
End Sub
Sub Service_Start (StartingIntent As Intent)
Dim StrMethod As String = "Sub Service_Start (StartingIntent As Intent)"
Try
Catch
If GBlnLoudExceptions Then LogColor("Exception: " & LastException.Message & " - Class: " & GStrClass & " - Method: " & StrMethod, Colors.Magenta)
End Try
End Sub
Sub Service_Destroy
Dim StrMethod As String = "Sub Service_Destroy"
Try
Catch
If GBlnLoudExceptions Then LogColor("Exception: " & LastException.Message & " - Class: " & GStrClass & " - Method: " & StrMethod, Colors.Magenta)
End Try
End Sub
When I run the apk, the app runs fine.
Now, when I restart the phone, it powers down as normal and resumes as normal except for a message that says, "Unfortunately, UKSM PhoneApp has stopped."
The error log displays the following:
B4X:
java.lang.RuntimeException: Unable to create service sortec.uksm.btphoneapp.svclocationtracking: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2681)
at android.app.ActivityThread.access$1600(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5297)
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:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at sortec.uksm.btphoneapp.svclocationtracking.onCreate(svclocationtracking.java:33)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2671)
... 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 sortec.uksm.btphoneapp.svclocationtracking.onCreate(svclocationtracking.java:31)
... 11 more
The only part of this that I recognise is svclocationtracking.java, which was what alerted me as I presume it is the java counterpart of my SvcLocationTracking.bas service class.
As you can see from my code, my standard practice for trapping exceptions are within each function/method, and so the 'Exception/Error spew' above means little to me.
However, the part that sticks out to me is an InvocationTargetException, which I found some information on here: http://developer.android.com/reference/java/lang/reflect/InvocationTargetException.html
The reason the service code is so empty is due to at first thinking that it was my code that was causing the malfunction, so I reduced it down as far as it would go and still get the error.
Changing #StartAtBoot: True to #StartAtBoot: False stops the error, but this is no good as I need the service to run on start-up.
Any help will be appreciated.
Last edited: