-2

I've created android apps which will collect GPS and store in MySQL database. It manages to collect and store right now. But how I make the GPS collector, collect in the background even the apps are killed. I had coded the GPS collector in my main activity.

Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105
Kevin Lee
  • 11
  • 1
  • see this solution is useful https://stackoverflow.com/questions/34573109/how-to-make-an-android-app-to-always-run-in-background/34573169#34573169 –  Jan 27 '18 at 13:48
  • See this solution is useful [https://stackoverflow.com/questions/34573109/how-to-make-an-android-app-to-always-run-in-background/34573169#34573169](https://stackoverflow.com/questions/34573109/how-to-make-an-android-app-to-always-run-in-background/34573169#34573169) –  Jan 27 '18 at 13:49

1 Answers1

0

Use

Services

A Service is an application component that can perform long-running operations in the background, and it does not provide a user interface. Another application component can start a service, and it continues to run in the background even if the user switches to another application

Service can handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.

you can try this http://www.vogella.com/tutorials/AndroidServices/article.html

MaYur MahAjan
  • 143
  • 10
  • is there any other solution except service? cause I have all my GPS collector codded in the main activity. anyway thank you. – Kevin Lee Jan 27 '18 at 18:59