简体   繁体   中英

network provider not working in android

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 when 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM