Michal
Michal

Reputation: 3632

Android EasyTracker class do not contain method getTracker()

I am using EasyTracker in my PreferenceActivity

@Override
public void onStart ()
{
    super.onStart();
    EasyTracker.getInstance(this).activityStart(this);
}

@Override
public void onStop ()
{
    super.onStop();
    EasyTracker.getInstance(this).activityStart(this);
}

But when I trying to call getTracker() method in EasyTracker class it is not there.

enter image description here

And this Android : Could not find method com.google.analytics.tracking.android.EasyTracker.getTracker do not help.

Upvotes: 1

Views: 1287

Answers (2)

DevNG
DevNG

Reputation: 6065

I believe you are using libGoogleAnalyticsServices.jar Version 3.x, where they change the API, so now the getIntance() method requires a Context object as an input. If you are using this inside an Activity just pass MyActivityName.this as a value.

For more information, see the Google Analytics SDK for Android: Migrating to v3: https://developers.google.com/analytics/devguides/collection/android/v3/migration

Upvotes: 0

Siddharth_Vyas
Siddharth_Vyas

Reputation: 10100

Using libGoogleAnalyticsV2.jar :

import com.google.analytics.tracking.android.EasyTracker;

    @Override
protected void onStart() {
    super.onStart();
    // Google Analytics Start Activity
    EasyTracker.getInstance().activityStart(this);
    EasyTracker.getTracker();
}

@Override
protected void onStop() {
    super.onStop();
    // Google Analytics Stop Activity
    EasyTracker.getInstance().activityStop(this);

}

Hope this helps.

Upvotes: 2

Related Questions