开发者

Android: How to structure GPS Logging feature in LBS App

I am planning to add a feature to an existing Android App. Because I don't have any experience in programming Android Apps I want to know how I can implement such a feature. I already researched for some time about it and also did some tutorials concerning Android Apps.

My idea at the moment looks like this:

I have an application that starts a normal Activity for the user to do something. This Activity already exists and should not be my concern. onCreate() it should additionally start a Service that will regulary request a Location update inside a while(true)-loop and send the result to a ContentProvider that will store the nessesary information in a SQLite db.

Also there should be a new menuitem to start a Gmaps view which will trigger the Gmaps Activity which then loads in an AsyncTask the stored locations from the db for presentation in the Gmap.

onDestroy() it will ask the user in a short Dialog if he likes to shut the logging Service down or continue that the user can later review his trip on Gmaps.

Is it开发者_StackOverflow社区 possible to create a feature in this way? Do I need to add something else or do parts of it in a different fashion?


onCreate() it should additionally start a Service that will regulary request a Location update inside a while(true)-loop and send the result to a ContentProvider that will store the nessesary information in a SQLite db.

This is not a good idea. LocationManager helps you achieve this via a listener. It looks like you have missed http://developer.android.com/guide/topics/location/obtaining-user-location.html. Another good resource is http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜