【问题标题】:Making a map on android在安卓上制作地图
【发布时间】:2016-12-06 20:06:27
【问题描述】:
我试图在 android 上制作一个使用智能手机 GPS 的典型地图,我正计划使用 Dijkstra 的最短路径算法。
我计划做的是制作一个岛屿的俯视图,并从我的 gps 收集岛屿道路上每个路口的纬度和经度数据,将图像(我制作的岛屿地图)与纬度和经度数据然后实现 Dijkstra 的最短路径算法。
有什么建议吗?
我将如何处理?
【问题讨论】:
标签:
android
google-maps
google-maps-api-3
gps
【解决方案1】:
首先
活动文件
谷歌地图谷歌地图;
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
【解决方案2】:
关注Getting Started
本指南是向 Android 应用添加地图的快速入门指南。 Android Studio 是推荐使用 Google Maps Android API 构建应用的开发环境。
步骤 1. 下载 Android Studio
第 2 步。安装 Google Play 服务 SDK
第 3 步。创建一个 Google 地图项目
第 4 步。获取 Google Maps API 密钥
第 5 步。您好地图!看代码
第 6 步。连接 Android 设备
第 7 步。构建并运行您的应用
启用 GPS:
@Override
protected void onStart() {
super.onStart(); // Always call the superclass method first
// The activity is either being restarted or started for the first time
// so this is where we should make sure that GPS is enabled
LocationManager locationManager =
(LocationManager) getSystemService(Context.LOCATION_SERVICE);
boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!gpsEnabled) {
// Create a dialog here that requests the user to enable GPS, and use an intent
// with the android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS action
// to take the user to the Settings screen to enable GPS when they click "OK"
}
}
希望这会有所帮助!