Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-device-info
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-device-info
Commits
0c40dcb0
Commit
0c40dcb0
authored
Apr 12, 2017
by
Noah Passalacqua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for phone number.
parent
ce93f5c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+3
-0
deviceinfo.js
deviceinfo.js
+1
-0
No files found.
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
0c40dcb0
...
...
@@ -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
;
}
}
deviceinfo.js
View file @
0c40dcb0
...
...
@@ -65,4 +65,5 @@ module.exports = {
isPinOrFingerprintSet
:
function
()
{
return
RNDeviceInfo
.
isPinOrFingerprintSet
;
},
getPhoneNumber
:
_
=>
RNDeviceInfo
.
phoneNumber
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment