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)

Most upvoted comments

@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.

image

Same issue.

My workaround: use Platform from react-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.