Android Question Widget and android.app.Service.START_STICKY

iz0ndg

Active Member
Licensed User
Longtime User
My program 'turnario vigili del fuoco' has a widget to the home screen with some information.
In the case where there is a 'service' (vigilanza) to do at a certain time, launches a notification.
I used 'StartServiceAt' for the alarm. I thought about using 'android.app.Service.START_STICKY' for not killing the service, but this sends the app to crash.
This is the error:

B4X:
LogCat connected to: 0123456789ABCDEF
--------- beginning of /dev/log/system


--------- beginning of /dev/log/main


** Service (service1) Destroy **
** Activity (main) Pause, UserClosed = true **
Ignoring event as service was destroyed.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (widget_turnario) Create **
** Service (widget_turnario) Start **
** Service (widget_turnario) Start **
** Activity (main) Pause, UserClosed = true **
** Service (widget_turnario) Create **
** Service (widget_turnario) Start **

widget_turnario_service_start (java line: 518)
java.lang.RuntimeException: Object should first be initialized (Intent).
   at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
   at anywheresoftware.b4a.objects.IntentWrapper.getAction(IntentWrapper.java:56)
   at turnariovf.giordanif.widget_turnario._service_start(widget_turnario.java:518)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
   at turnariovf.giordanif.widget_turnario.handleStart(widget_turnario.java:68)
   at turnariovf.giordanif.widget_turnario.onStartCommand(widget_turnario.java:53)
   at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2805)
   at android.app.ActivityThread.access$1900(ActivityThread.java:156)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437)
   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 de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to start service turnariovf.giordanif.widget_turnario@4226bcc0 with null: java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (Intent).


   at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2822)
   at android.app.ActivityThread.access$1900(ActivityThread.java:156)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437)
   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 de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (Intent).
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
   at turnariovf.giordanif.widget_turnario.handleStart(widget_turnario.java:68)
   at turnariovf.giordanif.widget_turnario.onStartCommand(widget_turnario.java:53)
   at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2805)
   ... 11 more
Caused by: java.lang.RuntimeException: Object should first be initialized (Intent).
   at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
   at anywheresoftware.b4a.objects.IntentWrapper.getAction(IntentWrapper.java:56)
   at turnariovf.giordanif.widget_turnario._service_start(widget_turnario.java:518)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
   ... 15 more
** Service (widget_turnario) Create **
** Service (widget_turnario) Start **

Can anyone help me ?
 
Top