【发布时间】:2017-01-11 10:10:45
【问题描述】:
我在我的应用程序中实现了firebase analytics,但没有显示任何事件或登录火基控制台。
在onCreateView()方法的每个片段中添加如下代码。
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);
}
使用的依赖是:
compile 'com.google.firebase:firebase-core:9.4.0'
使用的插件:
apply plugin: 'com.google.gms.google-services'
它工作正常并在调试控制台中显示这样的日志,
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
但 24 小时后在调试控制台和 Firebase 控制台中不显示任何上传消息,
那么,这里有什么问题吗?请帮忙。
【问题讨论】:
-
分析更新和显示记录需要几个小时。阅读此stackoverflow.com/questions/37347991/…
-
但我等了 4 到 5 天,但没有显示任何数据。
标签: android firebase-analytics