如何为Android安装一个应用程序,以显示谷歌地图上所有应用程序用户的位置? [英] how to devlope an app for android that will show the location of all app user on the google map?

查看:75
本文介绍了如何为Android安装一个应用程序,以显示谷歌地图上所有应用程序用户的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取使用该应用程序的所有用户位置?我想在地图上实时显示所有用户位置。所有用户位置都将显示给使用该应用程序的每个人。

how can i get all the user location who are using the application ? i want to show all the user location real-time on the map . All user location will be shown to everyone who are using the application.

推荐答案

1)只有您自己的应用程序可以使用



2)您的应用需要将其位置发送到全局服务器。



3)您在全局服务器中查询用户位置。



4)你在地图上显示位置列表。



到目前为止你做了什么?
1) It is only possible for your own applications

2) Your app needs to send it's "location" to a global server.

3) You query the global server for users locations.

4) You show the list of locations on a map.

What have you done so far?


查找当前纬度和经度的代码

步骤2 A来自解决方案1 ​​

Code to find current Latitude and Longitude
Step 2 A from Solution 1
GPSTracker gpsTracker = new GPSTracker(this);
        if (gpsTracker.canGetLocation()) {
            String stringLatitude = String.valueOf(gpsTracker.latitude);
            textview = (TextView) findViewById(R.id.fieldLatitude);
            textview.setText("Latitude: " + stringLatitude);

            String stringLongitude = String.valueOf(gpsTracker.longitude);
            textview = (TextView) findViewById(R.id.fieldLongitude);
            textview.setText("Longitude: " + stringLongitude);

            String country = gpsTracker.getCountryName(this);
            textview = (TextView) findViewById(R.id.fieldCountry);
            textview.setText("Country: " + country);

            String city = gpsTracker.getLocality(this);
            textview = (TextView) findViewById(R.id.fieldCity);
            textview.setText("City: " + city);

            String postalCode = gpsTracker.getPostalCode(this);
            textview = (TextView) findViewById(R.id.fieldPostalCode);
            textview.setText("PostalCode: " + postalCode);

            String addressLine = gpsTracker.getAddressLine(this);
            textview = (TextView) findViewById(R.id.fieldAddressLine);
            textview.setText("AddressLine: " + addressLine);
        } else {
            // can't get location
            // GPS or Network is not enabled
            // Ask user to enable GPS/network in settings
            gpsTracker.showSettingsAlert();
        }



希望这会帮助你。


Hope This Will Helps you.


这篇关于如何为Android安装一个应用程序,以显示谷歌地图上所有应用程序用户的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆