expo: Unable to record Android screen_name in FirebaseAnalytics in Expo SDK 44
Summary
When I use Expo SDK 44 on Android and FirebaseAnalytics.logEvent('screen_view', { ... }), the screen view is not recorded.
Description
In the following PR, setCurrentScreen has been deprecated.
The following PR deprecates setCurrentScreen, which sends screen_view in logEvent(), but it doesn’t work on Android.
https://github.com/expo/expo/pull/14366
The ability to send screen_view events with logEvent() will be available in iOS SDK since 6.29.0 and Android SDK since 17.5.0.
In expo-firebase-analytics, we are using iOS SDK 7.7.0 and Android SDK 17.2.1.
Therefore, the screen_view event can be sent on iOS, but not on Android.
Recent updates to the Firebase SDK (6.29.0 on iOS and 17.5.0 on Android) allow you to disable automatic screen tracking and manually log the screen_view event when it makes sense, regardless of your app’s design. https://adswerve.com/blog/a-new-approach-to-firebase-screenview-tracking/
In fact, when I sent the screen_view event on Android as shown below, I got the following error in Logcat.
(I’m using Managed workflow, but I did $ expo run:android -d to see the Logcat log)
await Analytics.logEvent('screen_view', { screen_name: 'TabTwo' });
or
await Analytics.setCurrentScreen('TabTwo');

Scope of influence
The following environments are likely to be affected
- Expo SDK 44
- Android
Probably not reproduced in Expo SDK 43 and below (not confirmed).
How to fix
Update the Firebase SDK for Android to 17.5.0 or higher.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
44
Environment
Expo CLI 5.0.3 environment info:
System:
OS: macOS 11.6
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /Users/syamamoto/.anyenv/envs/rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 27, 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.1, 30.0.2, 30.0.3
System Images: android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
npmPackages:
expo: ~44.0.0 => 44.0.5
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
npmGlobalPackages:
expo-cli: 5.0.3
Expo Workflow: bare
Reproducible demo
nothing
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 11
- Comments: 20 (4 by maintainers)
Having the same issue here,
logEvent("screen_view",firebase_screen:"name")works in expo go on an android device but won’t log anything in a standalone build.Kinda weird that this issue is not getting immediate attention since knowing screen views is so important …
no solution here. From what I can see, with the change they killed the screen_view event for android
https://github.com/expo/expo/commit/c88aafbe9780811398d0334ec15f15fc641280ae
I am currently having the same issue and I am not able to resolve the issue
Same issue here (Expo SDK 44 and
expo-firebase-analytics 6.0.0)Just to echo @tomosdevans, using the deprecated
setCurrentScreendoes not fix it, asexpo-firebase-analyticsis usinglogEventfor this method under the hood.Please can someone from Expo’s developer team acknowledge and provide some sort of idea when this might be fixed? Feels like it should be a high priority as otherwise it is messing up everyone’s basic analytics that upgrades to 44.
Is anyone looking into this? Feels like it should be a priority, since android screen_view is broken.
Thanks @mirzalikic - that’s useful info. My experience is that on expo-firebase-analytics 6.0.1,
setCurrentScreen()simply calls through tologEvent(screen_view, ...)and is subject to the same issue. From what I can tell, any versions below expo-firebase-analytics6.0.0cause compatibility issues with SDK 44 and therefore aren’t options (without downgrading the SDK).Does this sounds plausible? Is there any other workaround other than waiting until the underlying native SDK version is increased?
I have a similar issue as this except that the
logEventis working on app running on expo go using an actual android device. But when testing on a standalone android build, no event is received and displayed in DebugView of google analytics. If I use the deprecatedsetCurrentScreen, the screen events are showing.Environment