Add react-native-device-info
complete
Sébastien Lorber
Hi,
I think it would be useful to add this package to Expo as it permits to get in app extra data not yet provided by Expo
For example I would like to get in my JS the app version, and the versionCode / buildNumber.
For sure it's possible to rely currently on manifest data, but there's actually no strict guarantee, as far as I know, to ensure that versions in manifest do match version of plist/build.gradle.
For example, one can build a native 1.0.0 app, and yet publish a js bundle with manifest version 2.0.0 which would still install on native 1.0.0 app. By using Expo.Constants.manifest.version, you may actually not get the true native app version but instead the version of the manifest during last JS publish.
This is even more true for detached projects where, as far as I understand, the manifest version-related attributes are not really used anymore.
Reynaldo Rodriguez
Sébastien Lorber in which SDK version was this expo-device introduced? i'm on SDK 34 and values from Device are coming all null
ide
complete
expo-device (info about the device), expo-application (info about the current app), expo-cellular (info about the cell data connection), and expo-network (info about the network interface) provide the most common information that apps may need. These modules also work on web where possible.
There are some sensitive fields like the device’s IMEI that these modules do not attempt to expose. We do not plan to add these fields as Apple and Google have been making it harder or not possible to access these fields and they may require “dangerous“ permissions (according to the Android docs). Apps that respect user privacy almost never need these fields and we want app review to go smoothly for Expo developers, so we are not planning to add these sensitive fields.
Brent Vatne
ide: i know i'm biased because i work on expo but this is great! :P
Erik Paulsen Skålerud
We're using Expo for an app running on unmanaged tablets mounted on walls. Having getSerialNumber from react-native-device-info would be a tremendous help to us, for remote control/MDM purposes.
ide
Erik Paulsen Skålerud: getSerialNumber() allows for tracking users across apps and is supported only on Android. In the past years, Apple and Google have intentionally restricted APIs that allow access to these tracking identifiers -- on iOS the APIs have been removed entirely, and on Android the "READ_PHONE_STATE" permission is required. The Android docs list this permission's protection level as "dangerous": https://developer.android.com/guide/topics/manifest/permission-element#plevel.
Because this field is quite privacy-sensitive, works only on one underlying platform, and requires a "dangerous" permission, we are not planning to add APIs like getSerialNumber().
ide
under review
ide
In SDK 33 we added Constants.nativeAppVersion (the user-facing, short version string) and Constants.nativeBuildVersion (the longer version string): https://docs.expo.io/versions/latest/sdk/constants/#constantsnativeappversion. More generally, we are working on an "expo-device" module as well as other modules for measuring the power state that will achieve some of the same goals as "react-native-device-info" while being a stable, Expo-designed API.
Sébastien Lorber
ide: I'm fine with a new api as long as it's possible :)
Jens
ide: Hey there!
expo-device
looks like a great way to complement the current needs of the users using expo. Is expo-device
released already?ide
Jens: Yes, expo-device was first released with SDK 35.
W
Wang Riwu
Another useful info is
getDeviceLocale
, (e.g. "en-US"), from which we can derive the default language to use for the app (if the app supports multiple languages)ide
Wang Riwu: For the locale, please see the Localization API: https://docs.expo.io/versions/latest/sdk/localization/#localizationlocale-string