Search code examples
androidlong-polling

Long pulling android


I have Long Pull web service. How I can connect my android client with Long Pull server? I need permanent background service for receiving messages from server and show they as notifications.


Solution

  • I need permanent background service for receiving messages from server and show they as notifications.

    You cannot have a "permanent background service", unless you build your own firmware and implement it as a C/C++ daemon process.

    You can use startForeground() to reduce the odds of your service being automatically destroyed, but the user and the OS can still get rid of your process (along with its service) at any time for any reason.

    Many users do not like "permanent background services" because of the resources they waste, and therefore will attack developers of such services with task killers and low ratings on the Play Store.