0

I am writing an application that uses GPS to give distance to a starting line and speed and direction to that line. I have GPS running fine in a test file I wrote that prints out latitude and longitude and time to my cell phone display but it is a single activity. I need to have my program do calculations in the background on the GPS data, for example calculating speed from differences in location 10 seconds apart. This information needs to be viewed from several of my activity pages, which are individual classes. I think I need to create a helper class that contains the GPS service but I am not sure and not sure of the many things that are on the web what I should be looking at. Not sure how or where to fire off the helper and even if it is called helper as I can't find that in the Android docs. Also not sure what the best way to get the information from the GPS helper, if that is what it is called. After several hours of googling and searching Youtube, I am coming here for help.

4

1 に答える 1

0

私がお勧めするのは、サービスを使用して必要なデータを保存し、計算を実行することです。次に、サービスでカスタム メソッドを作成し、直接またはAIDL経由でアクセスできます。そのActivitiesデータを表示すると、更新ボタンなどを使用してデータにアクセスするメソッドを呼び出すか、タイマーを使用してそれらのメソッドを定期的にポーリングすることで、データにアクセスできます。

于 2012-07-10T02:51:31.810 に答える