I have a push service running for my application responsible for keeping the TCP connection alive and create notifications on incoming messages.
I need this service to run even if the activity is closed, so the solution posted online was to call startService() instead of bind(), and indeed this solves the problem of the service ending on activity destroyed.
However with no Binder how can I call methods of my service? One way I've managed to get to work is through BroadcastReceiver. Is there a simpler way to achieve such a behaviour?
add an action you use to call
startService, one for every different method/case you want to call/handle, and retrieve it withintent.getAction(), whenonStartCommandis calledFrom the documentation of startService