Android 打开 GPS 导航并获取位置信息
2010-10-19 17:18:28 来源:WEB开发网核心提示:41 if (location != null)42 {43 Log.w("Location", "Current altitude = "44 + location.getAltitude());45 Log.w("Location", "Curr
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 {
55 // TODO Auto-generated method stub
56 Log.i("onProviderDisabled", "come in");
57
58 }
59
60 @Override
61 public void onProviderEnabled(String provider)
62 {
63 // TODO Auto-generated method stub
64 Log.i("onProviderEnabled", "come in");
65 }
66
67 @Override
68 public void onStatusChanged(String provider, int status,
69 Bundle extras)
70 {
71 // TODO Auto-generated method stub
72 Log.i("onStatusChanged", "come in");
73
74 }
75
76 };
77 locationManager.requestLocationUpdates(provider, 1000, (float) 1000.0, llistener);
78 }
79
80 protected void onDestroy()
81 {
82 locationManager.removeUpdates(llistener);
83 locationManager.setTestProviderEnabled(provider, false);
84 super.onDestroy();
85 }
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 {
55 // TODO Auto-generated method stub
56 Log.i("onProviderDisabled", "come in");
57
58 }
59
60 @Override
61 public void onProviderEnabled(String provider)
62 {
63 // TODO Auto-generated method stub
64 Log.i("onProviderEnabled", "come in");
65 }
66
67 @Override
68 public void onStatusChanged(String provider, int status,
69 Bundle extras)
70 {
71 // TODO Auto-generated method stub
72 Log.i("onStatusChanged", "come in");
73
74 }
75
76 };
77 locationManager.requestLocationUpdates(provider, 1000, (float) 1000.0, llistener);
78 }
79
80 protected void onDestroy()
81 {
82 locationManager.removeUpdates(llistener);
83 locationManager.setTestProviderEnabled(provider, false);
84 super.onDestroy();
85 }
[]
更多精彩
赞助商链接