i want to use GPS in my App. but when i tried to retrieve GPS readings as shown belwo in the code, Android studio gave me the belwo mentioned error
despit all the required permissions are added to manifest file
code:
LocationManager lm = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
LocationListener ll = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
Log.w(TAG, "onLocationChanged");
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
Log.w(TAG, "onStatusChanged");
}
@Override
public void onProviderEnabled(String provider) {
Log.w(TAG, "onProviderEnabled");
}
@Override
public void onProviderDisabled(String provider) {
Log.w(TAG, "onProviderDisabled");
}
};
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, ll);//error at this line