How to Store Location information every 15 minutes in sqlite db & send to Server?

假装没事ソ 提交于 2019-12-06 14:50:43

问题


I need to work Location API for android where first the data is to be stored on Local Sqlite datbase in android itself each 15 minutes and then send it to a server, so that data can be tracked offline too.

Any suggestions, code or help is really appreciated !


回答1:


You, can simply create a background service then implements a location listener. In that location listener, you can set the time interval in the requestLocationUpdate method to ping the GPS at particular time intervals. or you can use timertask to send gps at particular intervals Here is a location manager instance:

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, timeinterval2, 0, locationListener);

You can send that location to the server from the service. You can also send notifications to launch the app.




回答2:


This question is many time asked in SO,

Use Alarm Manager and Service for this,

And go through this question

How can i send latitude longitude of android device every 15minute to php web service and How to get gps coordinates every minute in Android?



来源:https://stackoverflow.com/questions/8441736/how-to-store-location-information-every-15-minutes-in-sqlite-db-send-to-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!