The Device Info module provides information about the device on which the app is running.
getDeviceId()
To support applications built for PlayStation 4 running in compatibility mode on PlayStation 5, this method returns PlayStation 5
when running on an app built for PS4 on a PS5 system.
getSystemName()
To support applications built for PlayStation 4 running in compatibility mode on PlayStation 5, this method returns PROSPERO-ORBIS
when running on an app built for PS4 on a PS5 system.
When running on a PS4 system, ORBIS
is returned.
getSystemVersion()
On PS4, getSystemVersion()
is supported only for Debug builds.
For Release builds, this method returns “N/A”.
getClosedCaptionsStatus()
getDeviceLocale()
getDeviceName()
getDeviceManufacturer()
getDeviceType()
getDeviceModel()
To support applications built for PlayStation 4 running in compatibility mode on PlayStation 5, this method returns PlayStation 5
when running on an app built for PS4 on a PS5 system.
getMACAddress()
getTimeZone()
getUniqueID()
Currently, the Google Play Services Ads library is not being added as a dependency.
If you require the advertising ID for the Android device, you must add implementation com.google.android.gms:play-services-ads:15.0.1
to the dependencies section of your application module’s build.gradle.in file.
You can copy the template of that file from templates/mains/Resource/android/module
and place it within your project’s android/modules/<app_module>
folder.
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import {
DeviceInfo
} from '@youi/react-native-youi';
export default class DeviceInfoExample extends Component {
constructor(props) {
super(props);
DeviceInfo.getTimeZone().then(timeZone => {
this.setState({timeZone: timeZone});
}).catch(error => {
console.log(error);
});
}
state = {
deviceId: DeviceInfo.getDeviceId(),
systemName: DeviceInfo.getSystemName(),
systemVersion: DeviceInfo.getSystemVersion(),
deviceType: DeviceInfo.getDeviceType(),
deviceModel: DeviceInfo.getDeviceModel(),
deviceName: DeviceInfo.getDeviceName(),
deviceManufacturer: DeviceInfo.getDeviceManufacturer()
MACAddress: DeviceInfo.getMACAddress()
}
render() {
return (
<View style={styles.container}>
<Text style={styles.heading}>DeviceInfo exposes information about the device the app is running on.</Text>
<Text style={styles.text}>Device Id: {this.state.deviceId}</Text>
<Text style={styles.text}>System Name: {this.state.systemName}</Text>
<Text style={styles.text}>System Version: {this.state.systemVersion}</Text>
<Text style={styles.text}>Device Type: {this.state.deviceType}</Text>
<Text style={styles.text}>Device Model: {this.state.deviceModel}</Text>
<Text style={styles.text}>Device Name: {this.state.deviceName}</Text>
<Text style={styles.text}>Device Manufacturer: {this.state.deviceManufacturer}</Text>
<Text style={styles.text}>MAC Address: {this.state.MACAddress}</Text>
<Text style={styles.text}>Time Zone: {this.state.timeZone}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
backgroundColor: '#d0d0d0'
},
heading: {
fontSize: 16
},
text: {
fontSize: 12
}
});