其他分享
首页 > 其他分享> > 记录事件Firebase Analytics for Android

记录事件Firebase Analytics for Android

作者:互联网

我正在尝试为Android实施Firebase Analytics,但它无法正常运行.

到目前为止,我所做的就是https://firebase.google.com/docs/analytics/android/start/

private FirebaseAnalytics mFirebaseAnalytics;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //...
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

    mFirebaseAnalytics.setUserProperty("dev", "TEST");

    // [START custom_event]
    Bundle params = new Bundle();
    params.putString("dev_name", "dev_name_test");
    params.putString("dev_description", "Testing log events");
    mFirebaseAnalytics.logEvent("dev_test", params);
    // ....

此外,我已禁用禁用即时运行:

To disable Instant Run: Open the Settings or Preferences dialog.
Navigate to Build, Execution, Deployment > Instant Run. Uncheck the
box next to Enable Instant Run

知道为什么不工作吗?我在firebase仪表板中看不到任何内容.

解决方法:

验证记录和上载事件的最快方法是启用调试日志记录:View events in the Android Studio debug log

总之,在连接设备/模拟器的命令行中运行此命令:

adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

您应该在记录事件或设置属性以及上载数据时看到消息.

标签:firebase-analytics,android,firebase
来源: https://codeday.me/bug/20190824/1704541.html