开发者

How to send GPS data from android to server constantly until app close

I want to allow my app to send GPS data开发者_StackOverflow to server constantly in background after log in until app close..

I use locationManager to send GPS data....

I start to think about manual thread, AsynTask, to handle it....

Question:

  • locationManager.requestLocationUpdates(provider, 60, 5, this); it will update automatically after 60 ms???

  • Are there any good strategy to get GPS data and send it constantly to server in background until app closes?


Start an Android Service(android sdk class) in the background that automatically sends HTTP POSTs to a web service with the location that you are getting from the LocationManager class. You could persist each unique location in a SQLite database so that every location is sent. If the connection to the server is terminated a SQLite database could persist the data until the connection is re-established.


locationManager.requestLocationUpdates(provider, 60, 5, this); it will update automatically after 60 ms???

Yes or until it recognizes a distance difference of at least 5 meters, whichever takes place first.

Are there any good strategy to get GPS data and send it constantly to server in background until app closes?

You could use http sockets. http://socket.io/ Sockets are fun: Good beginners tutorial to socket.io?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜