简体   繁体   English

使用Google Maps在Android中跟踪位置

[英]Tracking location in android with google maps

I want to develop an android app where i want to locate a person nearest to me (this member is registered in my app). 我想开发一个Android应用程序,在其中我想找到离我最近的人(此成员已在我的应用程序中注册)。 I'm unable to proceed should i track the person with the help of mobile number or else is there any other way. 如果我要借助手机号码跟踪此人,或者有其他方法,我将无法继续进行。 Can anyone provide resources for this module 谁能为此模块提供资源

You can get a user current location and save it on your server . 您可以获取用户的当前位置并将其保存在服务器上。 you can get location when user location change in latitute and longitude and save it on your server and in other device when you want to get user location you can get it on your server just read the user lati and longi and convert it them in location. 当用户位置的经度和纬度发生变化时,您可以获取位置,然后将其保存在服务器上;如果要获取用户位置,则可以将其保存在服务器上。只需读取用户lati和longi并将其转换为位置,就可以在服务器上获取该位置。 and you can get user location in this ways. 这样您就可以获取用户位置。

Implement LocationListener interface in your Activity class and Implement onLocationChange(Location location) function, you will get users location on device, while sending location to your server capture mac id/imei of device and send along with it. 在Activity类中实现LocationListener接口并实现onLocationChange(Location location)函数,您将获得用户在设备上的位置,同时将位置发送到服务器捕获设备的mac id / imei并与之一起发送。 Also register LocationListener with the location manager service using the requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener) method. 还可以使用requestLocationUpdates(String provider,long minTime,float minDistance,LocationListener监听器)方法向位置管理器服务注册LocationListener。 With this you can identify which device has send you the location. 使用此工具,您可以确定哪个设备向您发送了位置信息。 Also while registering devices you have to save users mac id/imei to identify user. 同样,在注册设备时,您必须保存用户mac id / imei来标识用户。 I would suggest to use mac id as now a days there are many dual sim devices and if user changes sim slot then imei no might differ. 我建议使用mac id,因为现在有很多双SIM卡设备,如果用户更改SIM卡插槽,则imei no可能会有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM