I have implement firebase analytics
in my app, but not show up any event or log in fire base console.
Add bellow code in each fragment in onCreateView()
method.
private void addFragmentInFirebaseAnalytics() {
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(getContext());
FragmentItem fragmentItem = new FragmentItem();
fragmentItem.setFragmentId(Constant.FM_ID_MOIST_AIR);
fragmentItem.setFragmentName(MoistAirActivity.class.getSimpleName());
Bundle bundle = new Bundle();
bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, fragmentItem.getFragmentId());
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, fragmentItem.getFragmentName());
//Logs an app event.
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Log.d(TAG,"bundle >>"+bundle);
}
Used dependency is :
compile 'com.google.firebase:firebase-core:9.4.0'
used plugin :
apply plugin: 'com.google.gms.google-services'
Its work fine and show log like this in debug console,
09-14 12:30:42.967 D/FA ( 8821): Logging event (FE): select_content, Bundle
[{_o=app, _ev=item_id, item_name=MoistAirActivity, content_type=Navigation Menu,
_err=4}]
09-14 12:30:42.977 V/FA ( 8821): Using measurement service
09-14 12:30:42.977 V/FA ( 8821): Connecting to remote service
09-14 12:30:43.217 D/FA ( 8821): Connected to remote service
09-14 12:30:43.217 V/FA ( 8821): Processing queued up service tasks: 1
09-14 12:30:43.217 E/FA ( 8821): Task exception on worker thread: java.lang
.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. : com.goo
gle.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
09-14 12:30:48.217 V/FA ( 8821): Inactivity, disconnecting from AppMeasurem
entService
but not show any uploading message in debug console and firebase console after 24 hours,
So, whats wrong here ? please help.
Once the data is uploaded it takes about 3 hours for it to appear in the dashboard.
If you're creating a new Firebase project, enable Google Analytics during the project creation workflow. If you're using an existing Firebase project that doesn't have Google Analytics enabled, go to the Integrations tab of your settings > Project settings to enable it.
To exclude an event or user-scoped custom definition from being used to personalize ads: On the left, click Configure, then click either Events or Custom definitions. In the row for an event or user-scoped custom definition, click. . Click Mark as NPA (no personalized ads).
Finally i resolved this problem by replacing tools:node="replace" to tools:node="merge"
and add tools:replace="android:label"
in menifest file.
Reference : FirebaseApp with name [DEFAULT] doesn't exist
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With