I'm working on something very similar. I'm using background-action service to stablish socket connection with my server, similar to yours I'm too facing this issue that the background-action service gets killed after unpredictable time. did you find any solution to this problem?