expo: Device.osName on Android returns something similar to Device.osBuildFingerprint
đ Bug Report
Environment
Expo CLI 3.11.9 environment info: System: OS: Windows 10 Binaries: npm: 6.13.7 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338
Android Standalone (Expo SDK 35).
package.json dependencies:
"@expo/vector-icons": "^10.0.0",
"expo": "^35.0.0",
"expo-asset": "~7.0.0",
"expo-brightness": "~7.0.0",
"expo-cli": "^2.21.2",
"expo-constants": "~7.0.0",
"expo-device": "~1.0.0",
"expo-font": "~7.0.0",
"expo-image-picker": "~7.0.0",
"expo-keep-awake": "~7.0.0",
"expo-location": "~7.0.0",
"expo-permissions": "~7.0.0",
"expo-print": "~7.0.0",
"expo-task-manager": "~7.0.0",
"expo-web-browser": "~7.0.0",
"libphonenumber-js": "^1.7.20",
"moment": "^2.24.0",
"react": "16.8.3",
"react-moment": "^0.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"react-native-cli": "^2.0.1",
"react-native-gesture-handler": "~1.3.0",
"react-native-gifted-chat": "^0.9.11",
"react-native-maps": "~0.25.0",
"react-native-material-dropdown": "^0.11.1",
"react-native-material-textfield": "^0.12.0",
"react-native-reanimated": "~1.2.0",
"react-navigation": "^3.11.1",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-persist": "^5.10.0",
"expo-intent-launcher": "~7.0.0",
"react-native-screens": "~1.0.0-alpha.23"
Steps to Reproduce
Include import * as Device from 'expo-device';
and console.log(Device.osName);
somewhere in your file.
Expected Behavior
On Android Iâm expecting for âAndroidâ to be logged in console.
Actual Behavior
Logged value is something similar to the devices osBuildFingerprint
.
Example:
âŚ
âbrandâ: âHUAWEIâ,
âdesignNameâ: âHWPRA-Hâ,
âdeviceYearClassâ: 2014,
âisDeviceâ: true,
âŚ
âmanufacturerâ: âHUAWEIâ,
âmodelIdâ: null,
âmodelNameâ: âPRA-LX1â,
âosBuildFingerprintâ: âHUAWEI/PRA-LX1/HWPRA-H:8.0.0/HUAWEIPRA-LX1/401(C432):user/release-keysâ,
âosBuildIdâ: âPRA-LX1 8.0.0.401(C432)â,
âosInternalBuildIdâ: âHUAWEIPRA-LX1â,
âosNameâ: âHUAWEI/PRA-LX1/HWPRA-H:8.0.0/HUAWEIPRA-LX1/389(C432):user/release-keysâ,
âosVersionâ: â8.0.0â,
âplatformApiLevelâ: 26,
âproductNameâ: âPRA-LX1â,
âsupportedCpuArchitecturesâ: Array [
âarm64-v8aâ,
âarmeabi-v7aâ,
âarmeabiâ,
],
âtotalMemoryâ: 2915422208,
âŚ
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 24 (4 by maintainers)
@kbrandwijk This is 100% a bug. The API documentation heavily implies that the expected value of all Android devices should be âAndroidâ. I think this should be reopened.
Same issue.
My workaround: use
Platform
fromreact-native
.const platform = Platform.OS === 'android' ? 'Android' : 'iOS';
Itâs not a bug, itâs some devices natively reporting a different
osName
.Some Samsung are returning something like
samsung/a53xnaeea/a53x:13/TP1A.210814.014/A536PCJU9EWF9:user/release-keys
This is definitely not the expected behaviour and misled many many use cases.
+1 I believe this is a bug and think it should be reopened.
Whilst itâs clear the manufacturers have made a mistake (it wonât be rectified by them and will be set now, likely for the device lifetime) and because the react-native equivalent manages this eventuality without issue, Its fair to expect this package to do this same - Either that or the documentation should be updated to reflect the known devices that wonât get an accurate response.