如何自动启用网络位置提供商 [英] How to enable Network Location provider automatically
问题描述
我通过获取网络纬度和经度
这是给我的经度和纬度,但如果我的网络位置提供
取消选中
它永远不会为我提供当前位置的经度和纬度。
我要的是,我如何能够使网络位置提供
在电话不知道
用户,它被打开,
我怎样才能做到这一点?
我曾尝试是:
意向意图=新意图(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(意向,1);但是,这将在我的手机打开网页,检查它,我想自动检查意向意图=新意图(Intent.ACTION_MAIN);
intent.setClassName(com.android.phone,com.android.phone.Settings);
startActivity(意向);
这是不可能实现自动前面已经提到过网络供应商的位置。正确的方法是显示一个盒子,将用户重定向到设置页面。如前所述这里您可以通过轻微的黑客启用GPS。尽管如此,我不会建议这样做。
I am fetching Latitude and Longitude through network
It is giving me latitude and longitude but what if my NETWORK LOCATION PROVIDER
is unchecked
It will never provide me the Latitude and Longitude of the current location.
What i want is, How Can I enable the NETWORK LOCATION PROVIDER
in phone without knowing
user that It is opened,
How can i do that?
What i have tried is:
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivityForResult(intent, 1);
But this will open the page in my phone to check it i want to check AUTOMATICALLY
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.android.phone", "com.android.phone.Settings");
startActivity(intent);
It is impossible to enable the network provider location automatically as already mentioned. The correct way is to display a box and redirect the user to the settings page. You can enable GPS by using a slight hack as mentioned here. Still I wouldn't suggest doing that.
这篇关于如何自动启用网络位置提供商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!