Firebase Analytics - How to add Screen Names and L

2019-08-24 12:27发布

问题:

I want to add Screen Name and Log Event to Firebase's Analytics. I have tried below code, but I'm unable to see the Event & Screen Name in Firebase's Console.

//For Logging Event
Bundle bundle = new Bundle();
bundle.putString("custom_param",nameEditText.getText().toString());
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.GENERATE_LEAD, bundle);

//For Adding Screen Name
mFirebaseAnalytics.setCurrentScreen(this, "Visitor Entry", VisitorEntryActivity.class.getSimpleName());

I have already added Firebase SDK. I don't know what exactly settings I need to do. Thanks in advance.

回答1:

Under MyActivity.java put

protected void onResume() {
    isActivityLive = true;
    super.onResume();
    analytics.setCurrentScreen(this, "Screen Name", this.getClass().getSimpleName());
}