Need help on running activities on the background

Tutorials with advanced 'difficulty' and more Lines of Code.

Need help on running activities on the background

Postby shyamku1718 » Thu Nov 19, 2009 5:30 am

The requirement is sending GPS location to our webserver and viewing the website for traffic data.
Basically i wrote a Map Activity that will track the lat,lon as we drive down and sends the lat,lon everytime the location is changd to our server.The user selects a menu option to go to our website to see the traffic for that location.So user will be watching the website all the time but the Map activty started at first should keep sending the lat,lon information to our server.Because based on the location information we will show the traffic .

The problem is it sends the location information for the first time and when the user selects the menu option to go to the website then it stops sending the information as it is pushed down on the stack and paused i beleive.

Could you guys please throw some thoughts on how to handle this.I saw that we can use threads but i am wondering is there any entry on the manifest file or somwhere that will allow two activites run at the same time,

Any help is appreciated.
Posts: 3
Joined: Mon Nov 16, 2009 7:01 pm


Postby i4nc4mp » Sat Dec 19, 2009 6:50 pm

Perhaps you could use a remote service to accomplish this. I am not sure. At the moment I am researching for a similar solution, because I want my program to be able to respond to button presses even if the screen is asleep. I think I can use the remote service to run an invisible activity which can handle the key events. I am currently using a remote service that works no matter what the user is doing, but the way it works is through screen on/off broadcast receiver code. I hope the same thing could work for you, but I don't know what you would do in the remote service code.

So I recommend sai geetha's remote service tutorial as it looks like by default you can make the remote service run a task every processing tick, maybe you could do your stuff there -
Posts: 39
Joined: Sat Dec 12, 2009 6:44 pm


Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests