0

I am preparing app that will continuously run in the background and send data at a specific time interval to MySQL database. App user should be able to set the time interval from the app.

Option#1 - With Media Projection and using Services class - App runs in the background even if the app is removed/killed from task manager. But the user is not able to set time interval of choice to send data to MySQL database.

Option#2 - Using only Media Projection - App runs in the background but if the app is removed/killed from task manager then App will stop working in the background. Here App user is able to set time interval of choice to send data to MySQL database.

So, how can I make so that the App runs in the background and can not be killed/removed from task manager and still App user should be able to set time interval of choice to send data to MySQL database at specified time interval.

Thank You.

ViKiNG
  • 1,294
  • 2
  • 19
  • 26
  • `"So, how can I make so that the App runs in the background and can not be killed/removed from task manager"` fortunately you cannot do that - imagine this malicious app you cannot kill, would you like to have such app on your phone? – pskink Oct 17 '17 at 05:01
  • If i remove my app from task manager but i want still app running in background – kra.rd.test Oct 17 '17 at 05:02
  • fortunately you cannot do that - imagine this malicious app you cannot kill, would you like to have such app on your phone? – pskink Oct 17 '17 at 05:03
  • no i don't have any app in my phone like this – kra.rd.test Oct 17 '17 at 05:07
  • but some app running in background whenever we remove from in my recent app used. – kra.rd.test Oct 17 '17 at 05:08
  • "recent app used" != "task manager" – pskink Oct 17 '17 at 05:13
  • Ok but can you say me that if user remove the app from recently used app then after also app running in background? – kra.rd.test Oct 17 '17 at 05:22
  • simply use a foreground service - see https://developer.android.com/guide/components/services.html - in most cases it works pretty well – pskink Oct 17 '17 at 05:25
  • I also use service its work when user remove from recently used app but user can not select some time interval in services to execute some particular page or method call in app – kra.rd.test Oct 17 '17 at 05:28
  • In services its take some by default time interval like 1 seconds but i want user set the time interval and its not work in services – kra.rd.test Oct 17 '17 at 05:30

0 Answers0