diff --git a/CHANGELOG.md b/CHANGELOG.md index 68e8dc1ba..fcba32400 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ - Make play-services optional (https://github.com/rebeccahughes/react-native-device-info/pull/226) - Critical fix on WIFI STATE (https://github.com/rebeccahughes/react-native-device-info/pull/249) - Added `getTotalMemory` and `getMaxMemory` (https://github.com/rebeccahughes/react-native-device-info/pull/289) -- Introduced `getApplicationName` to see the name of the app both on ios, android and win (https://github.com/rebeccahughes/react-native-device-info/pull/210) +- Introduced `getApplicationName` to see the name of the app both on ios, android and win + - https://github.com/rebeccahughes/react-native-device-info/pull/210 + - https://github.com/rebeccahughes/react-native-device-info/pull/295 ### 0.12.0 diff --git a/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java b/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java index c1f6271f6..b3e9e3425 100644 --- a/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java +++ b/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java @@ -126,7 +126,6 @@ public String getCarrier() { PackageManager packageManager = this.reactContext.getPackageManager(); String packageName = this.reactContext.getPackageName(); - String applicationName = this.reactContext.getApplicationInfo().loadLabel(this.reactContext.getPackageManager()).toString(); constants.put("appVersion", "not available"); constants.put("appName", "not available"); @@ -136,11 +135,12 @@ public String getCarrier() { try { PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0); PackageInfo info = packageManager.getPackageInfo(packageName, 0); + String applicationName = this.reactContext.getApplicationInfo().loadLabel(this.reactContext.getPackageManager()).toString(); constants.put("appVersion", info.versionName); constants.put("buildNumber", info.versionCode); constants.put("firstInstallTime", info.firstInstallTime); constants.put("lastUpdateTime", info.lastUpdateTime); - constants.put("appName", packageManager.getApplicationLabel(applicationInfo).toString()); + constants.put("appName", applicationName); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); }