【发布时间】:2013-02-20 11:54:26
【问题描述】:
我正在构建一个需要 GPS 或网络操作的定位应用程序。我希望能够将用户引导至 GPS 或无线设置,以强制他们在未打开时将其打开。我的问题是,我如何检查他们是否真的在设置页面后打开了提供程序?
以下是引导用户进行设置的常用代码。之后我该怎么办?
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
boolean enabled = service
.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!enabled) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
}
【问题讨论】:
标签: android gps settings provider