You can find good info on services and the alarm manager in the Android documentation.įirst I created a broadcast receiver that simply starts my service when an internet connection is opened (I'm only interested if there is a connection - you might want to filter for the boot event as well). What I did was use a filter for the boot intent and then set an alarm using the alarm manager so that my app was restarted at regular intervals, and then it sent the data. It will probably be shut down by the operating system anyway, or it could be. I recently wrote one of these and decided it is not a good idea to leave a background service running. I would like the user to do other stuff on the phone while the updates are going on, so if you guys could point me to a tutorial that shows how to actually write background services (maybe these run as separate classes?) or other ways of doing this, that would be great. We aggregate information from all open source repositories. Home Open Source Projects Featured Post Tech Stack Write For Us We have collection of more than 1 Million open source products ranging from Enterprise product to small libraries in all platforms. I have seen many posts here on using background services with handlers, pending intents, and other things to do similar stuff, but I really don't understand how to do it. Mytracks - MyTracks for Android opensource. So it means I'm clueless at this point, never having used Android before. However, when I tried starting a periodic tracking method from inside the StartTrack Activity, using requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener) where minTime is the poll period from the server, it just did not work, and I'm not getting any errors. which allows you to collect data in the field including species name, location, measurements. Similarly, the trip is closed server-side upon the close trip request. Phones: Motorola DROID X2 smart phone from 2011 to 2013. This part works, in that I can display the response on the phone, and my server registers the user's action. Once the trip is started from the phone, the server responds with a polling period for the phone to use as the interval between updates. Being a newbie, I am not sure how to set up a background service that sends the location updates once every (pre-determined) period (min 3 minutes, max 1 hr) until the user flags the end of the trip, or until a preset amount of time elapses. The thing is that it is easy to pass data, including coords and other items, to the server when a user starts a trip or ends it. Jul 2nd - All you bikers out there will no doubt be interested to hear this news (that’s if you follow the Tour de France): My Tracks. I am running a Web service that allows users to record their trips (kind of like Google's MyTracks) as part of a larger app. Google My Tracks Will Provide Real-Time Tour de France Data.
0 Comments
Leave a Reply. |