How to get Location with Wifi in Android?

前端 未结 2 668
广开言路
广开言路 2021-01-05 13:55

I Want get location with Wifi and work in Google map, and it\'s not work for me but Gps is okay and not problem.

my code:

locationManager = (Location         


        
2条回答
  •  一向
    一向 (楼主)
    2021-01-05 14:34

    Say, can I setup "request Location Update" for GPS_PROVIDER and NETWORK_PROVIDER (or PASSIVE_PROVIDER) to same function call like this:

    // SETUP Location Manager
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
    locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, this);
    

    In this case, I get only GPS data.

提交回复
热议问题