Commit 0c40dcb0 authored by Noah Passalacqua's avatar Noah Passalacqua

Add support for phone number.

parent ce93f5c6
......@@ -9,6 +9,7 @@ import android.content.res.Configuration;
import android.os.Build;
import android.provider.Settings.Secure;
import android.webkit.WebSettings;
import android.telephony.TelephonyManager;
import com.google.android.gms.iid.InstanceID;
......@@ -84,6 +85,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
public @Nullable Map<String, Object> getConstants() {
HashMap<String, Object> constants = new HashMap<String, Object>();
TelephonyManager telMgr = (TelephonyManager) this.reactContext.getSystemService(Context.TELEPHONY_SERVICE);
PackageManager packageManager = this.reactContext.getPackageManager();
String packageName = this.reactContext.getPackageName();
......@@ -126,6 +128,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants.put("timezone", TimeZone.getDefault().getID());
constants.put("isEmulator", this.isEmulator());
constants.put("isTablet", this.isTablet());
constants.put("phoneNumber", telMgr.getLine1Number());
return constants;
}
}
......@@ -65,4 +65,5 @@ module.exports = {
isPinOrFingerprintSet: function () {
return RNDeviceInfo.isPinOrFingerprintSet;
},
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