Create a background service that will never stop RRS feed

  • Question

  • User377481 posted

    My project requires a background service that is updated every ten minutes and runs even if the application is killed. But now when the program is running and exiting and then backstage, it can run normally. When the program is deleted from the process, it will not run normally. Does anyone know why? What should I do? Thank you

    Wednesday, February 20, 2019 7:24 AM

All replies

  • User342125 posted

    Mobile platforms dont like always running background processes for multiple reasons such as battery life, performance and security. To this end deleting the process will always end all associated background tasks.

    What is it you are actually trying to achieve? Maybe there is a way of achieving it without an always running process?

    Wednesday, February 20, 2019 10:54 AM
  • User377481 posted

    @PaulNTU What I want to achieve is that my program is updated every 10 minutes in the background service.

    Thursday, February 21, 2019 1:02 AM
  • User65389 posted

    You should describe your problem in detail here and post your actual code here, so that someone can help you. To implement a process over a timer in the background should be no problem, but this timer then is related to the app. If the app is closed, also the timer don't run anymore.

    Thursday, February 21, 2019 6:24 AM
  • User342125 posted

    The best option is to try to avoid a timer type of system. When a device drops into deep sleep it reduces the functionality available to running applications and background tasks. The only solution is to try to wake lock the device to prevent it dropping into deep sleep but users will hate your application as it drains the battery on their device.

    Maybe explain what you plan to do every ten minutes and give us an idea of your project and requirements. Someone may have already implemented a similar system and be able to guide you to an alternative solution

    Thursday, February 21, 2019 9:02 AM
  • User377481 posted

    @PaulNTU My program is used to record some data (the amount of data may be a bit large), so I hope that every ten minutes, the program will judge whether there is data synchronized with the service, and then synchronize the data to the service.

    Thursday, February 21, 2019 9:26 AM
  • User342125 posted

    This is data collected and recorded within the app and the background service or is this data being collected on the server and the app is a acting as a data viewer (consumer)

    Thursday, February 21, 2019 9:37 AM