Question

I have a problem using the Google Play location services. I was trying to follow http://developer.android.com/training/location/retrieve-current.html more or less. However Eclipse tells me that it cannot resolve my LocationClient. My code looks like this:

    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    overridePendingTransition(0,0);

    mLocationClient = new LocationClient(this, this, this); 


    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }
}

@Override
protected void onStart() {
    super.onStart();
    // Connect the client.
    mLocationClient.connect();
}

I got a feeling, that the google-play-services library is not referenced proper, but when I got to the properties of my project there is a green check mark next to it. If you need more code let me know. Thanks in advance!

Was it helpful?

Solution

Close and reopen your project.

Clean and rebuild your project.

Make sure you've added the correct imports to your activity class.

Make sure you have private LocationClient mLocationClient; defined in your activity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top