开发者

network provider not working in android

开发者 https://www.devze.com 2023-03-09 03:43 出处:网络
i have to make an android application in which i need to find the current location of the user. For this i am first using the GPS provider, but if it is not available i fall back to the network provid

i have to make an android application in which i need to find the current location of the user. For this i am first using the GPS provider, but if it is not available i fall back to the network provider. Now there have been instances on my phone wh开发者_开发问答en even the network provider is not working and the statement network_enabled = lm .isProviderEnabled(LocationManager.NETWORK_PROVIDER);

is giving a false value.

My question

i am still able to make calls from my phone, so my network provider is working fine. what i need to know is in what conditions does the network provider not work? what could be the possible scenarios where the network provider on my android device not work to supply me my co-ordinates.

thank you in advance


Two days puzzled over this problem. I found a solution. Just go to Settings -> Location & security and enable flag "Use wireless networks" in "My Location" group.

But now I have the question: what is default state of this flag? It will be very sad if the application would have to ask the user to enable this flag.


You have to activate location via network providers in the Settings menu, and if at the start of the app it is disabled, you can show a Toast to notify the user

0

精彩评论

暂无评论...
验证码 换一张
取 消