how to get gps location android

前端 未结 5 1478
有刺的猬
有刺的猬 2020-12-08 17:32

I am trying to have a constant gps listener that will send its location (long and lat coordinates) to a web server every x mins. On a button click it will also send its loca

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 18:18

    You can create a thread that will run in background and every x minutes you get the actual position by calling a function that does that (Note that you want to make a function that get the x,y coordinates since you will use that on button click aswel). For the code you posted :

    locationManager.requestUpdates(provider, minTime, minDistance, intent);
    

    That means that your application will send a request to gps module every x min for the whatshouldIputhere?

    Good luck, Arkde

提交回复
热议问题