如何检查GPS传感器当前是否正在读取信号?

时间:2012-02-23 10:19:17

标签: android gps

如何检查GPS是否正在读取信号。我已经编写了一个代码来检查GPS是否已启用。

private void systemService() {
    locMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    if(!locMgr.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
     AlertDialog.Builder noGps = new AlertDialog.Builder(this);
     noGps.setMessage("GPS is off. Please turn it on and restart your Application.");
     noGps.show();
     }// end of if        
}// end of systemsService();

但是,即使启用它,GPS传感器也需要几分钟或几秒钟来接收信号。

我的问题是:如何检查GPS传感器当前是否正在接收信号?

1 个答案:

答案 0 :(得分:0)

据我所知,你不能。 您可以使用runOnFirstFix在可用时使用位置数据,还可以使用requestLocationUpdates定义更新间隔。