Unverified Commit d80e333d authored by Gant Laborde's avatar Gant Laborde Committed by GitHub

Merge pull request #295 from alvarezloaiciga/master

Fix applicationName
parents 583f7f5d ae5f3c8e
......@@ -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
......
......@@ -126,7 +126,6 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
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 class RNDeviceModule extends ReactContextBaseJavaModule {
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();
}
......
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