I use Volley library to connect with server in my app. Now, I have to send request in background every 5 minutes also when app is not running (killed by user). How should I do it? With background services, AlarmManager
(Google says that it isn't good choice for network operations) or something else?
Or maybe SyncAdapter will be good for it?
You can use a TimerTask with scheduleAtFixedRate in a service class to achieve this, here is an example of Service class, you can use it
You can use sendRequestToServer method to connect with the server. Here is the manifest declaration of the Service.
To start the service from MainActivity,
I prefer to use Android Handler because it is executes in UI Thread by default.