开发者

java.lang.InterruptedException While Trying to Get Location

开发者 https://www.devze.com 2023-03-07 17:30 出处:网络
Here is my code: Criteria criteria = new Criteria(); LocationProvider locationProvider = LocationProvider.getInstance(criteria);

Here is my code:

        Criteria criteria = new Criteria();
        LocationProvider locationProvider = LocationProvider.getInstance(criteria);
        Location currentLocation = locationProvider.getLocation(300);

It throws the exception at the third line. How can I开发者_运维问答 fix this?


Do you run your application in the simulator? If yes ,then you have to change the IT policy. Go to Simulate select Set IT Policy & GPS Location as given below.

java.lang.InterruptedException While Trying to Get Location

java.lang.InterruptedException While Trying to Get Location

java.lang.InterruptedException While Trying to Get Location

I hope this will help you.. :)


I figured it out. When I am in a closed area GPS cannot receive data and throws InterruptedException.

0

精彩评论

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