Im trying to implement a simple application which gives latitude and longitudinal coordinates of our present location.But im gettng this error shown in screen shot Screen Shot
Asked
Active
Viewed 31 times
0
-
Please post the error. – vguzzi Nov 24 '15 at 15:56
-
you should also post your maximum code, here, not the screenshot – Androider Nov 24 '15 at 16:14
2 Answers
0
You must implement this methods
TextView longitude, latitude;
//get current location coordinates
LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
//here you will get your current locations
longitude.setText(location.getLongitude() + "");
latitude.setText(location.getLatitude() + "");
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
}
};

Jemo Mgebrishvili
- 5,187
- 7
- 38
- 63
0
The reason you are getting this error is because in Android 6.0 (Marshmallow) they introduced the ability to turn off permissions. This error is indicating that you are not checking to see if the location permissions are enabled before proceeding. You can easily implement the permissions by clicking on the offending code, then clicking on the hint light-bulb icon on the left, then generating the check permission code.
I have answered a question like this before with some nice examples of how to properly check for permissions and request for them if need-be. I'm trying to find it again so I can link it to you.
EDIT: Found it! GPS reading cant be retrieved