-1
return TODO;

I am trying to detect userlocation using fused location API,it asks me to check permission from user but it gives "Cannot resolve symbol TODO"

private Location getLocation() {
    // If Google Play Services is available
    if (servicesConnected()) {
        // Get the current location
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return TODO;
        }
            return LocationServices.FusedLocationApi.getLastLocation(locationClient);
        } else {
            return null;
        }
    }
}
Zaniel
  • 61
  • 6

2 Answers2

1

TODO typically means that there is some work "to do." At that location in the code.

Usually it is in a comment, but in this case it appears intentionally broken to provide an obvious signal that you as a developer need to make a decision regarding what to return there. Notice there is a big comment right above it describing what actions you may want to take there.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
1

You should notice that return TODO as a code statement will try to return the variable named TODO. Since, the compiler is not able to do find this variable, it says TODO is not resolved.

TODO when put in as a comment states that the developer needs to complete some action there. e.g. //TODO decide what to return from here

You should probably return a null here since the app doesnt have permission here. So,

return null;