添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
B4X is a set of simple and powerful cross platform RAD tools:
  • B4A (free) - Android development
  • B4J (free) - Desktop and Server development
  • B4i - iOS development
  • B4R (free) - Arduino, ESP8266 and ESP32 development
  • All developers, with any skill level, are welcome to join the B4X community .

    Android Question How to start httputil2service in foreground while the app is in background?

    My app works fine in foreground; if I put it in the background by tapping Home button, after 3 successful httpjob calls, the app crashed with following error messages during the 4th httpjob call.
    Could someone kindly give me som hint on how to fix the error, please?
    ** Service (httputils2service) Destroy **
    Service started in the background. Trying to start again in foreground mode.
    java.lang.RuntimeException: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.deedeegroup.quisila/.httputils2service
    at anywheresoftware.b4a.keywords.Common$12.run(Common.java:1215)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
    Caused by: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.deedeegroup.quisila/.httputils2service
    at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
    at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
    at android.os.Parcel.readParcelable(Parcel.java:3346)
    at android.os.Parcel.createExceptionOrNull(Parcel.java:2433)
    at android.os.Parcel.createException(Parcel.java:2422)
    at android.os.Parcel.readException(Parcel.java:2405)
    at android.os.Parcel.readException(Parcel.java:2347)
    at android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6968)
    at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1927)
    at android.app.ContextImpl.startForegroundService(ContextImpl.java:1893)
    at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:798)
    at anywheresoftware.b4a.keywords.Common.StartServiceImpl(Common.java:924)
    at anywheresoftware.b4a.keywords.Common.StartService(Common.java:911)
    at anywheresoftware.b4a.keywords.Common$12.run(Common.java:1183)
    ... 8 more
    Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActiveServices.startServiceLocked(ActiveServices.java:771)
    at com.android.server.am.ActiveServices.startServiceLocked(ActiveServices.java:679)
    at com.android.server.am.ActivityManagerService.startService(ActivityManagerService.java:14102)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2960)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3036) This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies. Accept Learn more…