I'm doing some tests on a small app to understand how firebase-analytics works. This is the code for the MainActivity:
public class MainActivity extends AppCompatActivity {
private FirebaseAnalytics mFirebaseAnalytics;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(getApplicationContext());
mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
mFirebaseAnalytics.setMinimumSessionDuration(10000);
mFirebaseAnalytics.setSessionTimeoutDuration(300);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID,"ID");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME,"NAME");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE,"image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
}
To see if my app send data to Firebase I tryed to use DebugView but it says that there isn't any devices available, i also used the command
adb shell setprop debug.firebase.analytics.app <package_name>
but nothing changed.
If i use these 3 commands
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
i can see that my app is sending some data to firebase, like in this picture
What can i do to enable DebugView and see what my app send to firebase in real time?
If you have only an Internal traffic filter active and the developer one is testing or inactive, then you won't see your data in DebugView. Activate the developer filter too. It might take some time until you start seeing data in the debug view after you configure those filters.
To enable Analytics debug mode in your browser, install the Google Analytics Debugger Chrome extension. Once installed, enable the extension and refresh the page. From that point on, the extension will log events in your app in debug mode. You can view events logged in the DebugView in the Firebase console.
Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled, further executions of the application will also be in debug mode.
Please ensure that the following steps have been followed:
Step 1: Your app is properly configured in the Firebase console to support the Analytics features.
Step 2:
A) If you are simply working with single build variant, the following command is enough:
adb shell setprop debug.firebase.analytics.app [your_app_package_name]
B) But if you are working with multiple build variants with different application IDs which are not the same as the app package name, be sure to execute the following command:
adb shell setprop debug.firebase.analytics.app [your_application_id]
Here, application ID is the app ID of your build variant found in the corresponding gradle file. For example, lets say you have x.gradle and y.gradle for two build variants x and y, and you also have the general build.gradle file. To debug the build variant x with application ID com.abc.x, the command will be:
adb shell setprop debug.firebase.analytics.app com.abc.x
Similarly, to debug the build variant y with application ID com.abc.y, the command will be:
adb shell setprop debug.firebase.analytics.app com.abc.y
This behavior persists until you explicitly disable it by executing the following command:
adb shell setprop debug.firebase.analytics.app .none.
I had the same symptoms as you did. In my case the problem was simply because I forgot to turn on WiFi, so events couldn't be propagated to cloud but were appearing in logcat.
You can see your list of devices -> adb devices
and then -> adb shell setprop debug.firebase.analytics.app package_name
after that, in Android Studio, run by Debug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With