Android仅在90秒后尝试获取位置

时间:2019-02-21 16:29:04

标签: android gps android-source

在我们正在开发的自定义Android设备上,GPS /位置信息存在一些问题。通常,GPS速度非常快,但是启动后我第一次请求位置时,大约需要90秒钟才能得到修复。我以为首先这是AGPS的问题,但似乎工作正常。

这里是logcat的摘录。我在15:37:02启动了一个请求GPS的应用程序。发生的事情不多,大约90秒钟后,我得到了很多活动。

我添加了一些在此处不可见的其他调试语句,似乎正在发生的事情是,仅在90秒后,Android尝试通过NTP获取时间,然后尝试执行AGPS,并在几秒钟内得到了修复。请注意,该设备当前未插入SIM卡。是否有人知道会导致这种行为的原因?我认为Android等待的原因是出于节电的原因,它会先尝试GPS之前的其他位置来源,但是对我来说这并不重要,因为该设备不是由电池供电的。

# logcat | grep -Ei '(gps|locatio)'
...
02-21 15:36:49.362  2555  4381 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.chartcross.gpstest/.GPSTest (has extras)} from uid 10009 on display 0
02-21 15:36:49.436  2555  2763 I ActivityManager: Start proc 5898:com.chartcross.gpstest/u0a27 for activity com.chartcross.gpstest/.GPSTest
...
02-21 15:37:00.806  4736  5100 I GCoreUlr: Starting service, intent=Intent { act=com.google.android.location.reporting.ACTION_UPDATE_WORLD cmp=com.google.android.gms/com.google.android.location.reporting.service.DispatchingService (has extras) }, extras=Bundle[{receiverAction=init, is_boot=true}]
02-21 15:37:00.976  4736  5126 I GCoreUlr: WorldUpdater received intent Intent { act=com.google.android.location.reporting.ACTION_UPDATE_WORLD cmp=com.google.android.gms/com.google.android.location.reporting.service.DispatchingService (has extras) } with receiverAction com.google.android.location.internal.server.ACTION_RESTARTED
02-21 15:37:01.260  4736  5126 I GCoreUlr: WorldUpdater:com.google.android.location.internal.server.ACTION_RESTARTED: Ensuring that reporting is stopped because of reasons: (no Google accounts)
02-21 15:37:01.904  4736  5126 I GCoreUlr: WorldUpdater received intent Intent { act=com.google.android.location.reporting.ACTION_UPDATE_WORLD cmp=com.google.android.gms/com.google.android.location.reporting.service.DispatchingService (has extras) } with receiverAction init
02-21 15:37:02.661  2555  4381 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.chartcross.gpstest/.GPSTest (has extras)} from uid 10009 on display 0
02-21 15:37:02.714  2555  6671 I ActivityManager: Start proc 7164:com.chartcross.gpstest/u0a27 for activity com.chartcross.gpstest/.GPSTest
...
02-21 15:38:32.349  2555  2838 D GpsLocationProvider: received SIM related action:
02-21 15:38:32.356  2555  2838 D GpsLocationProvider: SIM MCC/MNC is still not available
02-21 15:38:32.356  2555  2838 D GpsLocationProvider: received SIM related action:
02-21 15:38:32.361  2555  2838 D GpsLocationProvider: SIM MCC/MNC is still not available
02-21 15:38:32.689  2555  2838 D GpsLocationProvider: receive broadcast intent, action: android.intent.action.SIM_STATE_CHANGED
02-21 15:38:32.689  2555  2838 D GpsLocationProvider: received SIM related action:
02-21 15:38:32.698  2555  2838 D GpsLocationProvider: SIM MCC/MNC is still not available
02-21 15:38:32.699  2555  2838 D GpsLocationProvider: receive broadcast intent, action: android.intent.action.SIM_STATE_CHANGED
02-21 15:38:32.699  2555  2838 D GpsLocationProvider: received SIM related action:
02-21 15:38:32.704  2555  2838 D GpsLocationProvider: SIM MCC/MNC is still not available
02-21 15:38:32.704  2555  2838 D GpsLocationProvider: received SIM related action:
02-21 15:38:32.709  2555  2838 D GpsLocationProvider: SIM MCC/MNC is still not available
02-21 15:38:35.207  2555  2838 D GpsLocationProvider: setRequest ProviderRequest[ON interval=0]
02-21 15:38:35.214  2555  2838 D GpsLocationProvider: startNavigating, singleShot is false
02-21 15:38:35.214  2555  2838 D GpsLocationProvider: setting position_mode to standalone
02-21 15:38:35.214  2555  2838 V GpsLocationProvider: reportStatus status: 1
02-21 15:38:35.215  2555  2838 D GpsLocationProvider: setRequest ProviderRequest[OFF]
02-21 15:38:35.216  2555  2838 D GpsLocationProvider: stopNavigating
02-21 15:38:35.216  2555  2838 V GpsLocationProvider: reportStatus status: 2
02-21 15:38:35.218  2555  2838 D GpsLocationProvider: receive broadcast intent, action: android.net.conn.CONNECTIVITY_CHANGE
02-21 15:38:35.223  2555  2838 D GpsLocationProvider: setRequest ProviderRequest[ON interval=0]
02-21 15:38:35.223  2555  2838 D GpsLocationProvider: startNavigating, singleShot is false
02-21 15:38:35.223  2555  2838 D GpsLocationProvider: setting position_mode to standalone
02-21 15:38:35.223  2555  2838 V GpsLocationProvider: reportStatus status: 1
02-21 15:38:35.237  2555  4243 D MARTIAN_ANDROID: 142.496 ZS location_cb
02-21 15:38:35.238  2555  4243 V GpsLocationProvider: reportLocation lat: XXXXXX long: XXXXXX timestamp: 1550759917000
02-21 15:38:35.238  2555  4243 D GpsLocationProvider: TTFF: 14

0 个答案:

没有答案