I finally found a solution to this LoL problem
If you override the onBind method and call the work using the enqueueWork method, you need to return the binding to the work engine that does this:
@Override @Nullable public IBinder onBind(@NonNull Intent intent) { [... Do What You Want ... ] return super.onBind(intent); }
We return the IBinder of the super.onBind method, so you should use it to bind to JobIntentService.
If you want to bind and return another binder, you can do this:
@Override @Nullable public IBinder onBind(@NonNull Intent intent) { IBinder binder = initSynchronizer(); new Thread( () -> onHandleWork(intent) ).start(); return binder; }
So by launching you "onHandleWork" in another topic. So you can use:
"bindService (....., JobIntentService.BIND_AUTO_CREATE);"
contact the service and return your Binder. In any case, when you disconnect from the service, the service will be killed, and if it still works, you will not be able to bind it again because the service was killed, but the thread in which "onHandleWork" is still running ...
Therefore, I suggest that you use this version only if you need to complete a task that must interact with the activity until it becomes active, and should still work if the activity is destroyed (without the ability to bind jobService again but just to start a new one ...)
In order not to kill the service after unlinking, you need to run it in the "foreground" in the "stopForeground" in "onDestroy". That way, you are still serving only for the thread that processes the "onHandleWork" methods.
I hope that Google will solve this damn fast LoL, I have converted all the old "Service" and "IntentService" to new jobs, but ... they work really worse than before!
So far, enjoy coding;)