WEB开发网
开发学院手机开发Android 开发 Android 打开 GPS 导航并获取位置信息 阅读

Android 打开 GPS 导航并获取位置信息

 2010-10-19 17:18:28 来源:WEB开发网   
核心提示:29 String serviceName = Context.LOCATION_SERVICE;30 locationManager = (LocationManager) getSystemService(serviceName);31 locationManager.setTestProviderEnabled(
29     String serviceName = Context.LOCATION_SERVICE;
30     locationManager = (LocationManager) getSystemService(serviceName);
31     locationManager.setTestProviderEnabled("gps", true);
32     provider = locationManager.getBestProvider(criteria, true);
33     Log.d("provider", provider);
34
35     llistener = new LocationListener() {
36       @Override
37       public void onLocationChanged(Location location)
38       {
39         // TODO Auto-generated method stub
40         Log.i("onLocationChanged", "come in");
41         if (location != null)
42         {
43           Log.w("Location", "Current altitude = "
44               + location.getAltitude());
45           Log.w("Location", "Current latitude = "
46               + location.getLatitude());
47         }
48         locationManager.removeUpdates(this);
49         locationManager.setTestProviderEnabled(provider, false);
50       }
51
52       @Override
53       public void onProviderDisabled(String provider)
54       {

上一页  1 2 3 4  下一页

Tags:Android GPS 导航

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接