LocationManager's getBestProvider returning null

后端 未结 2 1123
Happy的楠姐
Happy的楠姐 2020-12-06 04:33

I have a bunch of people reporting an error that I cannot reproduce. When trying to open a MapView it\'s reporting that the getBestProvider is retu

2条回答
  •  抹茶落季
    2020-12-06 04:49

    In your call to getBestProvider() you've asked for enabled providers only (that's the second parameter in the method call which you have set to true). If the user has disabled all providers, you will get null.

    In any case, you need to be able to deal with the situation where there are no available providers, so you'll need to check for null and tell the user that he has not enabled any location.

提交回复
热议问题