试试这个片段代码
findViewById(R.id.tvOrderTitle).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String strClickLogs;
Bundle params = new Bundle();
params.putString("mobileno", logMobileno);
params.putString("name", logName);
params.putString("email", logEmail);
strClickLogs = "Eventlogs_Generated";
Log.e(TAG, strClickLogs);
//Logs an app event.
mFirebaseAnalytics.logEvent(strClickLogs, params);
}
});
您可以在Logcat中查看生成的详细日志,格式如下:
V/FA-SVC:记录事件:origin=app,name=Eventlogs_Generated,params=Bundle[{mobileno=9876543210, firebase_event_origin(_o)=app, firebase_screen_class(_sc)=SupplierListActivity, firebase_screen_id(_si)=7001228486350086694, name=Ashish Tikarye,电子邮件=ashisht@set.com}]