- GPS Provider
- Network Provider
and back to Network Provider.
we have to create LocationManager and LocationListener and don't forget to check the permission.
LocationManager:
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Check the permission:
int permissionCheck = ContextCompat.checkSelfPermission(MapsActivity.this,
Manifest.permission.ACCESS_FINE_LOCATION);
and to get the location we can access it by:
Location locationNet = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
then we can access the Network Location Provider Latitude and Longitude with
locationNet.getLatitude();
andlocationNet.getLongitude();
with double value type as return.
okay done for Location Provider with Network Provider
good luck friends. ^__^
"The biggest failure in life is to die without ever tried"
No comments:
Post a Comment