此存储库(https://github.com/rebeccahughes/react-native-device-info#usage)似乎具有一些通过react native访问设备信息的方法。
有人从实际设备中获取一些示例输出数据吗?
最好了解一下数据的外观,而不必在大量设备上编译和运行它。
答案 0 :(得分:2)
这是我在多个设备和仿真器上运行它的结果。
以下是DeviceInfo的特定方法调用以及结果输出。我更改了一些标识值,但是保留了每个值的格式,与设备输出的格式完全相同。我没有输出DeviceInfo上可用的所有方法,只是输出了当前对我有用的方法。希望这可以帮助某人:
(Kindle Fire)
getDeviceName: Name of My Kindle Fire
getUniqueID: 123ba45a678901a2
getManufacturer: Amazon
getModel: KFAUWI
getSystemName: Android
getSystemVersion: 5.1.1
getBrand: Amazon
getAPILevel: 22
getUserAgent: Mozilla/5.0 (Linux; Android 5.1.1; KFAUWI Build/LVY48F; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Safari/537.36
isTablet: true
getApplicationName: My Awesome App
getBundleId: com.app.awesome
getBuildNumber: 1
getVersion: 0.0.0
getReadableVersion: 0.0.0.1
(三星Galaxy S8)
getDeviceName: Name of My Phone
getUniqueID: f12edc3b4af56e78
getManufacturer: samsung
getModel: SM-G950U
getSystemName: Android
getSystemVersion: 8.0.0
getBrand: samsung
getAPILevel: 26
getUserAgent: Mozilla/5.0 (Linux; Android 8.0.0; SM-G950U Build/R16NW; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.70 Mobile Safari/537.36
isTablet: false
getApplicationName: My Awesome App
getBundleId: com.app.awesome
getBuildNumber: 1
getVersion: 0.0.0
getReadableVersion: 0.0.0.1
(运行Pixel C平板电脑的avd仿真器)
getDeviceName: Unknown
getUniqueID: 9a876b5432109cde
getManufacturer: unknown
getModel: Android SDK built for x86
getSystemName: Android
getSystemVersion: 5.1.1
getBrand: Android
getAPILevel: 22
getUserAgent: Mozilla/5.0 (Linux; Android 5.1.1; Android SDK built for x86 Build/LMY48X) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36
isTablet: true
getApplicationName: My Awesome App
getBundleId: com.app.awesome
getBuildNumber: 1
getVersion: 0.0.0
getReadableVersion: 0.0.0.1
(从xCode启动的iPhone模拟器)
getDeviceName: nameofmyapplemachine
getUniqueID: 48FC4A5D-D189-6623-6DB2-B28CCC88D10D
getManufacturer: Apple
getModel: iPhone 6
getSystemName: iOS
getSystemVersion: 11.4
getBrand: Apple
getAPILevel: not available
getUserAgent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79
isTablet: false
getApplicationName: My Awesome App
getBundleId: com.app.awesome
getBuildNumber: 11
getVersion: 0.0.11
getReadableVersion: 0.0.11.11
(从xCode启动的iPad模拟器)
getDeviceName: nameofmyapplemachine
getUniqueID: DA6BEB1C-7C8D-9DD3-CA46-C06AD59E55DF
getManufacturer: Apple
getModel: iPad Air 2
getSystemName: iOS
getSystemVersion: 11.4
getBrand: Apple
getAPILevel: not available
getUserAgent: Mozilla/5.0 (iPad; CPU OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79
isTablet: true
getApplicationName: My Awesome App
getBundleId: com.app.awesome
getBuildNumber: 11
getVersion: 0.0.11
getReadableVersion: 0.0.11.11
(iPad 2物理设备)
getDeviceName: Name of My iPad
getUniqueID: AD059D5A-E0D4-3326-6F0C-B8DAB8A5CA6F
getManufacturer: Apple
getModel: iPad 2
getSystemName: iPhone OS
getSystemVersion: 9.3.5
getBrand: Apple
getAPILevel: not available
getUserAgent: Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13G36
isTablet: true
getApplicationName: My Awesome App
getBundleId: com.app.awesome
getBuildNumber: 11
getVersion: 0.0.11
getReadableVersion: 0.0.11.11