My app consists of login based user system in which the user will receive his tasks. User's list of task need to be regularly synced with the server so that any new task would reflect immediately on the app. I have done this kind of sync stuff before in other apps but i would like to know the best approach to do it. I have two approaches in my mind please let me know which one is better or if you have any another idea then please tell me.
APPROACH 1
I can use IntentService and AlarmManager to to run background service at fixed interval of time and check for any change on sever through a http request (i.e. app to server request).
APPROACH 2
I can host a small TCP server through my app using NanoHTTPD library and after every new entry on server i can make request from the server to this small TCP host informing about these changes (i.e. server to app request).
I have used APPROACH1 before but i am interested in APPROACH2 more( i think this will drain less battery). So please let me know which one is better way(i.e. more efficient, secure, etc) to do it. If you have any other idea then please feel free to share it.