I got 2 classes: A(Activity subclass) which generates the phone location infinitely and class B (thread subclass) which takes the location from A and send it to the db.
Since it’s an activity it’s stop generating the locations once I close my application so I guess service would make the job.
I read about services in here(http://developer.android.com)
but I couldn’t understand which service should I use and how?
The change that I’m planning to do is to turn A into a service and create class C(activity) which start & stop A.
Thanks.
You can use Timer for this..
Execute or call a method at a certain time.
You can read here for more details.