@Star-Dust
When B4A13.0 uses SDK34 and android:targetSdkVersion="34" , your library will crash. There is a issue about "MissingForegroundServiceTypeException" in SDK34.
I know the useful library is too old and not maintained. I wonder if you have any improvements? Thanks.
There is the log -
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
*** Service (standout) Create ***
standout_service_create (java line: 522)
android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{a7b24e5 7489:b4a.example/u0a215} targetSDK=34
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
at android.os.Parcel.readParcelableInternal(Parcel.java:5075)
at android.os.Parcel.readParcelable(Parcel.java:5057)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3237)
at android.os.Parcel.createException(Parcel.java:3226)
at android.os.Parcel.readException(Parcel.java:3209)
at android.os.Parcel.readException(Parcel.java:3151)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7167)
at android.app.Service.startForeground(Service.java:776)
at anywheresoftware.b4a.objects.ServiceHelper.StartForeground(ServiceHelper.java:85)
at b4a.example.standout._service_create(standout.java:522)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at b4a.example.standout.onCreate(standout.java:69)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4976)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8699)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Service started in the background. Trying to start again in foreground mode.
*** Service (starter) Create ***
** Service (starter) Start **
Service started in foreground mode.
java.lang.RuntimeException: Unable to start service b4a.example.starter@f6b9049 with Intent { cmp=b4a.example/.starter (has extras) }: java.lang.RuntimeException: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c46eb09 7566:b4a.example/u0a215} targetSDK=34
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5164)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2468)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8699)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Caused by: java.lang.RuntimeException: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c46eb09 7566:b4a.example/u0a215} targetSDK=34
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent(ServiceHelper.java:173)
at b4a.example.starter.handleStart(starter.java:102)
at b4a.example.starter.access$000(starter.java:8)
at b4a.example.starter$1.run(starter.java:74)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:240)
at b4a.example.starter.onStartCommand(starter.java:72)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5146)
... 9 more
Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c46eb09 7566:b4a.example/u0a215} targetSDK=34
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
at android.os.Parcel.readParcelableInternal(Parcel.java:5075)
at android.os.Parcel.readParcelable(Parcel.java:5057)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3237)
at android.os.Parcel.createException(Parcel.java:3226)
at android.os.Parcel.readException(Parcel.java:3209)
at android.os.Parcel.readException(Parcel.java:3151)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7167)
at android.app.Service.startForeground(Service.java:776)
at anywheresoftware.b4a.objects.ServiceHelper.StartForeground(ServiceHelper.java:85)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent(ServiceHelper.java:171)
... 15 more
When B4A13.0 uses SDK34 and android:targetSdkVersion="34" , your library will crash. There is a issue about "MissingForegroundServiceTypeException" in SDK34.
I know the useful library is too old and not maintained. I wonder if you have any improvements? Thanks.
There is the log -
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
*** Service (standout) Create ***
standout_service_create (java line: 522)
android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{a7b24e5 7489:b4a.example/u0a215} targetSDK=34
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
at android.os.Parcel.readParcelableInternal(Parcel.java:5075)
at android.os.Parcel.readParcelable(Parcel.java:5057)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3237)
at android.os.Parcel.createException(Parcel.java:3226)
at android.os.Parcel.readException(Parcel.java:3209)
at android.os.Parcel.readException(Parcel.java:3151)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7167)
at android.app.Service.startForeground(Service.java:776)
at anywheresoftware.b4a.objects.ServiceHelper.StartForeground(ServiceHelper.java:85)
at b4a.example.standout._service_create(standout.java:522)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at b4a.example.standout.onCreate(standout.java:69)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4976)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8699)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Service started in the background. Trying to start again in foreground mode.
*** Service (starter) Create ***
** Service (starter) Start **
Service started in foreground mode.
java.lang.RuntimeException: Unable to start service b4a.example.starter@f6b9049 with Intent { cmp=b4a.example/.starter (has extras) }: java.lang.RuntimeException: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c46eb09 7566:b4a.example/u0a215} targetSDK=34
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5164)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2468)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8699)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Caused by: java.lang.RuntimeException: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c46eb09 7566:b4a.example/u0a215} targetSDK=34
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent(ServiceHelper.java:173)
at b4a.example.starter.handleStart(starter.java:102)
at b4a.example.starter.access$000(starter.java:8)
at b4a.example.starter$1.run(starter.java:74)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:240)
at b4a.example.starter.onStartCommand(starter.java:72)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5146)
... 9 more
Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{c46eb09 7566:b4a.example/u0a215} targetSDK=34
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
at android.os.Parcel.readParcelableInternal(Parcel.java:5075)
at android.os.Parcel.readParcelable(Parcel.java:5057)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3237)
at android.os.Parcel.createException(Parcel.java:3226)
at android.os.Parcel.readException(Parcel.java:3209)
at android.os.Parcel.readException(Parcel.java:3151)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7167)
at android.app.Service.startForeground(Service.java:776)
at anywheresoftware.b4a.objects.ServiceHelper.StartForeground(ServiceHelper.java:85)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleStartIntent(ServiceHelper.java:171)
... 15 more