【发布时间】:2015-07-02 08:53:54
【问题描述】:
我的应用程序需要 GPS,因此当执行特定操作时,我会检查 GPS 是否已启用,如下所示(正如 Marcus 在 this 其他问题中所建议的那样):
if (!locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER )) {
buildAlertMessageNoGps();
}
rootView = inflater.inflate(R.layout.fragment_alert, container, false);
[...]
问题是用户无法通过位置设置启用 GPS(例如,通过单击“返回”按钮并返回应用程序)。在这种特殊情况下,片段会为相应进程注入布局,但 GPS 仍处于禁用状态。如何解决?
【问题讨论】:
标签: android gps location fragment settings