如果我们使用此代码,我们会看到一条消息:正在搜索GPS。然而,仅示出了符号; GPS不实际工作:如何在我的android应用程序中以编程方式打开GPS?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
this.sendBroadcast(intent);
}
为什么不工作?以及如何使其正确工作?
在kitkat os版本之后,您无法以语法方式启用和禁用gps。 –
请帮我看看有没有什么根访问是为了获得Gps活动以编程方式启用或禁用它不工作在4.1.2 –
@ user3578377:你见过我的答案? –