Fatal Exception: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=org.kontalk/.service.registration.RegistrationService }: app is in background uid UidRecord{3356b13 u0a237 CAC bg:+12m37s722ms idle change:cached procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1616)
at android.app.ContextImpl.startService(ContextImpl.java:1571)
at android.content.ContextWrapper.startService(ContextWrapper.java:669)
at org.kontalk.service.registration.RegistrationService.start(RegistrationService.java:1492)
at org.kontalk.ui.NumberValidation$5.run(NumberValidation.java:421)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7398)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:919)
Move the start() call to onResume and ensure the RegistrationService won't do first-time stuff after the first onStartCommand.
Apparently the postDelayed trick didn't work :-)
Move the start() call to onResume and ensure the RegistrationService won't do first-time stuff after the first onStartCommand.