Enable Firebase debugView Events in React native
Asked Answered
S

5

26

I have been trying to connect my ReactNative App to firebase for two reasons - 1. Push Notifications ( Done Successfully ) 2. Events logging for each user.

I am facing issues with debugView to get live events in development mode, I am able to see my events in streamView but after some delay.

enter image description here

for the above - for android - adb shell setprop debug.firebase.analytics.app "package_name"

and for ios, I have added -FIRAnalyticsDebugEnabled to my xcode scheme.

but still none of these seems working.

I have RN0.44.

thank you,

Stockish answered 5/1, 2018 at 18:29 Comment(2)
I have the same problem.Textbook
@EarlFerguson: You need to add two things,-FIRAnalyticsDebugEnabled , -FIRDebugEnabled and also make sure you have correct Google-Services.json , It will work.Stockish
W
14

For ios, it's possible to launch app in the simulator with FIRDebugEnabled argument.

xcrun simctl launch "iPhone 8" com.your.package -FIRDebugEnabled

Edit:

I had to pass FIRAnalyticsDebugEnabled to make debug view show data.

xcrun simctl launch "iPhone 8" com.your.package -FIRAnalyticsDebugEnabled
Wrangler answered 6/9, 2021 at 17:11 Comment(2)
The answer was 3 years after the question, but was exactly what I needed when searching, so thanks!Linnet
perfect, thanks! btw com.your.package is the bundle identifierWavellite
T
4

For others facing this issue, you can just run this command:

adb shell setprop debug.firebase.analytics.app <package_name>

more details here

Tungsten answered 28/6, 2018 at 14:10 Comment(1)
this is only for Android, but the OP was asking about both Android and iOSChangteh
H
1

In case you look for some alternative with npx react-native, you can try:

npx react-native run-ios --simulator="<simulator_name>" --scheme="<scheme_name>" -- -FIRAnalyticsDebugEnabled
Huba answered 13/10, 2023 at 19:59 Comment(0)
D
0

I'll leave the Android details in this post.

  1. Open the emulator with yarn react-native run-android or npx react-native run-android. This command also opens the JS server. Once it succeeds to open the app, proceed to the next step.
  2. Use the command to check the device: adb devices. The app will disconnect, but it's fine. This step is to make sure adb uses the right emulator.
  3. Enable the debug mode using adb: adb shell setprop debug.firebase.analytics.app <package_name>.
  4. Use the opened emulator, search for the app with the <package_name>, and open it. If it is opened, close and re-open it.

You shall see the device shows up in the Firebase debug view.

Duffy answered 29/5, 2023 at 7:27 Comment(0)
M
0

In my case (react native, iOS app) Debug View started working when I set the analytics_auto_collection_enabled flag to true. It was set to false as suggested in the Firebase docs.

firebase.json

{
  "react-native": {
    "analytics_auto_collection_enabled": true
  }
}
Mandie answered 8/8, 2023 at 23:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.