Loading RNDeviceInfo/RNDeviceInfo.m +14 −8 Original line number Diff line number Diff line Loading @@ -132,6 +132,12 @@ RCT_EXPORT_MODULE() return language; } - (NSString*) deviceCountry { NSString *country = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; return country; } - (NSDictionary *)constantsToExport { UIDevice *currentDevice = [UIDevice currentDevice]; Loading @@ -146,6 +152,7 @@ RCT_EXPORT_MODULE() @"deviceId": self.deviceId, @"deviceName": currentDevice.name, @"deviceLocale": self.deviceLocale, @"deviceCountry": self.deviceCountry, @"uniqueId": uniqueId, @"bundleId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"], @"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], Loading @@ -156,4 +163,3 @@ RCT_EXPORT_MODULE() } @end android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java +6 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { } } private String getCurrentCountry() { Locale current = getReactApplicationContext().getResources().getConfiguration().locale; return current.getCountry(); } @Override public @Nullable Map<String, Object> getConstants() { HashMap<String, Object> constants = new HashMap<String, Object>(); Loading Loading @@ -77,6 +82,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { constants.put("model", Build.MODEL); constants.put("deviceId", Build.BOARD); constants.put("deviceLocale", this.getCurrentLanguage()); constants.put("deviceCountry", this.getCurrentCountry()); constants.put("uniqueId", Secure.getString(this.reactContext.getContentResolver(), Secure.ANDROID_ID)); constants.put("systemManufacturer", Build.MANUFACTURER); constants.put("bundleId", packageName); Loading deviceinfo.js +4 −1 Original line number Diff line number Diff line Loading @@ -43,5 +43,8 @@ module.exports = { }, getDeviceLocale: function() { return RNDeviceInfo.deviceLocale; } }, getDeviceCountry: function() { return RNDeviceInfo.deviceCountry; }, }; Loading
RNDeviceInfo/RNDeviceInfo.m +14 −8 Original line number Diff line number Diff line Loading @@ -132,6 +132,12 @@ RCT_EXPORT_MODULE() return language; } - (NSString*) deviceCountry { NSString *country = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; return country; } - (NSDictionary *)constantsToExport { UIDevice *currentDevice = [UIDevice currentDevice]; Loading @@ -146,6 +152,7 @@ RCT_EXPORT_MODULE() @"deviceId": self.deviceId, @"deviceName": currentDevice.name, @"deviceLocale": self.deviceLocale, @"deviceCountry": self.deviceCountry, @"uniqueId": uniqueId, @"bundleId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"], @"appVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], Loading @@ -156,4 +163,3 @@ RCT_EXPORT_MODULE() } @end
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java +6 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { } } private String getCurrentCountry() { Locale current = getReactApplicationContext().getResources().getConfiguration().locale; return current.getCountry(); } @Override public @Nullable Map<String, Object> getConstants() { HashMap<String, Object> constants = new HashMap<String, Object>(); Loading Loading @@ -77,6 +82,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { constants.put("model", Build.MODEL); constants.put("deviceId", Build.BOARD); constants.put("deviceLocale", this.getCurrentLanguage()); constants.put("deviceCountry", this.getCurrentCountry()); constants.put("uniqueId", Secure.getString(this.reactContext.getContentResolver(), Secure.ANDROID_ID)); constants.put("systemManufacturer", Build.MANUFACTURER); constants.put("bundleId", packageName); Loading
deviceinfo.js +4 −1 Original line number Diff line number Diff line Loading @@ -43,5 +43,8 @@ module.exports = { }, getDeviceLocale: function() { return RNDeviceInfo.deviceLocale; } }, getDeviceCountry: function() { return RNDeviceInfo.deviceCountry; }, };