Commit 1c6d1e04 authored by Rebecca Hughes's avatar Rebecca Hughes

Merge pull request #8 from donald-jackson/master

Add user defined deviceName field
parents e6407db3 175e723f
......@@ -132,6 +132,7 @@ RCT_EXPORT_MODULE()
@"systemVersion": currentDevice.systemVersion,
@"model": self.deviceName,
@"deviceId": self.deviceId,
@"deviceName": currentDevice.name,
@"uniqueId": uniqueId,
@"bundleId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"],
@"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.learnium.RNDeviceInfo">
<uses-permission android:name="android.permission.BLUETOOTH"/>
</manifest>
......@@ -48,7 +48,17 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
String deviceName = "Unknown";
try {
BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter();
deviceName = myDevice.getName();
} catch(Exception e) {
e.printStackTrace();
}
constants.put("deviceName", deviceName);
constants.put("systemName", "Android");
constants.put("systemVersion", Build.VERSION.RELEASE);
constants.put("model", Build.MODEL);
......
......@@ -34,5 +34,8 @@ module.exports = {
},
getReadableVersion: function() {
return RNDeviceInfo.appVersion + "." + RNDeviceInfo.buildNumber;
},
getDeviceName: function() {
return RNDeviceInfo.deviceName;
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment