0
我只需要监控GPS接收器或适配器的状态,导致我的应用程序不想工作,如果GPS是由用户手动禁用...监控GPS接收器/适配器状态
试图使用信息从此链接,但没有帮助 - How can I monitor the status of the GPS adapter using Android SDK?
任何想法该怎么办?
我只需要监控GPS接收器或适配器的状态,导致我的应用程序不想工作,如果GPS是由用户手动禁用...监控GPS接收器/适配器状态
试图使用信息从此链接,但没有帮助 - How can I monitor the status of the GPS adapter using Android SDK?
任何想法该怎么办?
要检查你的GPS的可用性,可以使用下面的代码
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
if(!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
//gps off. User turned the GPS off manually.
}
boolean gpSstate = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
boolean networkState =locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if(!gpsState && !networkState) {// no GPS Service }
谢谢..这个工作.. – Sergio 2011-05-26 12:31:00