When I use this lines for Google Analytics, I get this error: Error occurred
An error has occurred in sub: java.lang.NoSuchMethodException: getTracker()
B4X:
Dim r As Reflector
r.Target = r.RunStaticMethod("com.google.analytics.tracking.android.EasyTracker", "getTracker", Null, Null)
r.RunMethod2("sendView", "<pnlChartContains>", "java.lang.String")
public class myTrackedActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
... // The rest of your onStart() code.
EasyTracker.getInstance(this).activityStart(this); // Add this method.
}
@Override
public void onStop() {
super.onStop();
... // The rest of your onStop() code.
EasyTracker.getInstance(this).activityStop(this); // Add this method.
}
}
And this:
B4X:
// May return null if EasyTracker has not yet been initialized with a property
// ID.
Tracker easyTracker = EasyTracker.getInstance(this);
// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to null.
easyTracker.set(Fields.SCREEN_NAME, "Home Screen");
easyTracker.send(MapBuilder
.createAppView()
.build()
);