gpt4 book ai didi

Android Firebase Analytics 无法正常工作

转载 作者:行者123 更新时间:2023-12-05 00:21:39 24 4
gpt4 key购买 nike

我想使用 Google Firebase Analytics 跟踪点击了哪个按钮。

我试过的代码:

public class MainActivity extends AppCompatActivity {
private FirebaseAnalytics mFirebaseAnalytics;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}

public void onClick(View view) {
int btn_id = view.getId();
if (view.getId() == R.id.Btn1) {
//Some content
} else if (view.getId() == R.id.Btn2 {
//Some content
} else if (view.getId() == R.id.Btn3) {
//Some content
}
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_ID, String.valueOf(btn_id));
mFirebaseAnalytics.logEvent("homebtn_event", params);
}
}

上面的代码跟踪点击按钮但不返回 btn_id 或者在 Firebase Analytics 数据中点击了哪个按钮

最佳答案

Firebase 分析事件将在 24 小时后显示在仪表板上



You can enable verbose logging to monitor logging of events by the SDK to help verify that events are being logged properly. This includes both automatically and manually logged events.



您可以使用一系列 adb 命令启用详细日志记录:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC

This command displays your events in the Android Studio logcat, helping you immediately verify that events are being sent.



Reference

关于Android Firebase Analytics 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43109733/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com