Amir Panahandeh
Amir Panahandeh

Reputation: 9039

Firebase Analytics doesn't show any data in dashboard

I'm trying to log an event and current screen with Firebase Analytics and I'm getting this logs in my logcat:

App measurement is starting up, version: 9877
Registered activity lifecycle callback
Checking service availability
Service available
Connecting to remote service
onActivityCreated
Activity resumed, time: 234385086
Connected to remote service
Logging event (FE): _e, Bundle[{_o=auto, _et=9309, _sc=IntroActivity, _si=-6959962515326329023}]
setCurrentScreen cannot be called while no activity active
Logging event (FE): select_content, Bundle[{item_name=main, _o=app, content_type=image, item_id=1}]

and this is my code:

mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "main");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
mFirebaseAnalytics.setCurrentScreen(MainActivity.this,"Main","Home");

but after going to Firebase console there is no data from my application. why?

Upvotes: 2

Views: 3701

Answers (1)

djabi
djabi

Reputation: 5767

As the method documentation mentions you should call setCurrentScreen from the activity onResume callback while the activity is in foreground (before onPause is callback is called). The screen name/class applies only to the current activity that is foreground. Calling it without activity is foreground is not possible as there is no visible UI to associate the screen name/class with and therefore you get the warning that this call has no effect.

Upvotes: 9

Related Questions