Issue
I was reading "Mastering Firebase for Android Development", by Ashok Kumar S, published by Packt Publishing, 2018. The book has a section called "Firebase Analytics for Android". I followed all the steps from that section and now I only need to check if my implementation was successful. The book explains how to do it:
We can check whether events are being logged by enabling verbose logging, as shown here:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
Where in Android Studio can I run those commands? Thank you.
UPDATE 1:
I guess I can run it from the terminal in Android Studio:
I think I could run it even outside of Android Studio, from the terminal. But where should I navigate to? Maybe to the location where I have adb
installed? Thank you.
UPDATE 2:
I am getting this message: bash: adb: command not found
. See what I am doing from the terminal that I have access to from Android Studio:
Jaimes-MacBook-Pro:platform-tools jaimemontoya$ pwd
/Users/jaimemontoya/Library/Android/sdk/platform-tools
Jaimes-MacBook-Pro:platform-tools jaimemontoya$ ls
NOTICE.txt deployagent.jar etc1tool make_f2fs sload_f2fs
adb deploypatchgenerator.jar fastboot mke2fs source.properties
api dmtracedump hprof-conv mke2fs.conf sqlite3
deployagent e2fsdroid lib64 package.xml systrace
Jaimes-MacBook-Pro:platform-tools jaimemontoya$ adb shell setprop log.tag.FA VERBOSE
bash: adb: command not found
Jaimes-MacBook-Pro:platform-tools jaimemontoya$
Solution
I checked whether events were being logged by enabling verbose logging, as shown here:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
For testing purposes, I used the following code in my InitialActivity.java
:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "InitialActivity");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Then I went to the command line to execute the adb
commands to see from the Android Studio debug logs the data that I sent:
$ pwd
/Users/jaimemontoya/Library/Android/sdk/platform-tools
[My MacBook Pro]:platform-tools jaimemontoya$ ./adb logcat -v time -s FA FA-SVC
I can see the data that I sent:
02-21 11:46:35.585 D/FA ( 3106): Logging event (FE): select_content, Bundle[{item_name=FirstActivity, firebase_event_origin(_o)=app}]
02-21 11:46:36.389 V/FA ( 6924): Logging event: origin=app,name=select_content,params=Bundle[{item_name=FirstActivity, firebase_event_origin(_o)=app}]
02-21 11:46:36.399 V/FA ( 6924): Event recorded: Event{appId='com.couponclub', name='select_content', params=Bundle[{item_name=FirstActivity, firebase_event_origin(_o)=app}]}
Answered By - Jaime Montoya
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.