请帮助我在OlaCabs等移动应用中打开GPS.
我正在使用以下代码:
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if(!provider.contains("gps")){ //if gps is disabled
final Intent poke = new Intent();
poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
poke.setData(Uri.parse("3"));
sendBroadcast(poke);
}
但是它无法打开GPS.
解决方法:
Android准则已在4.0版以上更改.您无法以编程方式关闭高于4.0版本的GPS …
不要像我一样浪费你的时间
要使用对话框,请检查它:
或者那个:
标签:performance,android-layout,xamarin,gps,android
来源: https://codeday.me/bug/20191119/2038306.html