Commit c362de2b authored by Gant Laborde's avatar Gant Laborde Committed by GitHub

Merge pull request #222 from rafaeltakiyama/master

First and Last Install Time
parents 5e1740de df7b56b3
...@@ -187,6 +187,8 @@ var DeviceInfo = require('react-native-device-info'); ...@@ -187,6 +187,8 @@ var DeviceInfo = require('react-native-device-info');
| App is running on a tablet | `isTablet()` | true | if app is running on a tablet return true | | App is running on a tablet | `isTablet()` | true | if app is running on a tablet return true |
| PIN or fingerprint set | `isPinOrFingerprintSet()(callback)`| | Only supported in Android and iOS 9.0 and above | PIN or fingerprint set | `isPinOrFingerprintSet()(callback)`| | Only supported in Android and iOS 9.0 and above
| Phone Number | `getPhoneNumber()` | "2348675309" or "" or null | Only supported in Android | Phone Number | `getPhoneNumber()` | "2348675309" or "" or null | Only supported in Android
| First Install Time | `getFirstInstallTime()` | 1505607068808 | Only supported in Android |
| Last Install Time | `getLastUpdateTime()` | 1505607068808 | Only supported in Android |
Since the device setting for PIN/Fingerprint can be modified while the app is still open, this is available via callback instead of as a constant. To use, pass a callback function to the returned bridge function in your javascript: Since the device setting for PIN/Fingerprint can be modified while the app is still open, this is available via callback instead of as a constant. To use, pass a callback function to the returned bridge function in your javascript:
......
package com.learnium.RNDeviceInfo; package com.learnium.RNDeviceInfo;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager; import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class RNDeviceInfo implements ReactPackage { public class RNDeviceInfo implements ReactPackage {
......
...@@ -97,6 +97,8 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -97,6 +97,8 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
PackageInfo info = packageManager.getPackageInfo(packageName, 0); PackageInfo info = packageManager.getPackageInfo(packageName, 0);
constants.put("appVersion", info.versionName); constants.put("appVersion", info.versionName);
constants.put("buildNumber", info.versionCode); constants.put("buildNumber", info.versionCode);
constants.put("firstInstallTime", info.firstInstallTime);
constants.put("lastUpdateTime", info.lastUpdateTime);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -21,3 +21,5 @@ export function getInstanceID(): string; ...@@ -21,3 +21,5 @@ export function getInstanceID(): string;
export function isEmulator(): boolean; export function isEmulator(): boolean;
export function isTablet(): boolean; export function isTablet(): boolean;
export function isPinOrFingerprintSet(): (cb: (isPinOrFingerprintSet: boolean) => void) => void; export function isPinOrFingerprintSet(): (cb: (isPinOrFingerprintSet: boolean) => void) => void;
export function getFirstInstallTime(): number;
export function getLastUpdateTime(): number;
...@@ -65,5 +65,11 @@ module.exports = { ...@@ -65,5 +65,11 @@ module.exports = {
isPinOrFingerprintSet: function () { isPinOrFingerprintSet: function () {
return RNDeviceInfo.isPinOrFingerprintSet; return RNDeviceInfo.isPinOrFingerprintSet;
}, },
getFirstInstallTime: function () {
return RNDeviceInfo.firstInstallTime;
},
getLastUpdateTime: function () {
return RNDeviceInfo.lastUpdateTime;
},
getPhoneNumber: _ => RNDeviceInfo.phoneNumber getPhoneNumber: _ => RNDeviceInfo.phoneNumber
}; };
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