-2

How can i get current location using WiFi? In my project using gps I can get current location ... How can I use network service in android?

LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener currentlocation = new CurrentLocation();
        mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                currentlocation);

But I want current location WiFi? Can anyone help me for getting current location using WiFi?

1
  • 5
    @Nanne what if i dont have 1....besides wifi is lot better can be controlled Apr 16, 2012 at 10:12

1 Answer 1

1

Try to use NETWORK_PROVIDER.

Please note, that you will have to amend your AndroidManifest.xml as well by adding:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
1
  • 1
    ACCESS_FINE_LOCATION implies ACCESS_COARSE_LOCATION. There is no need to add both. Nov 4, 2013 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.