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
218d3e97
Commit
218d3e97
authored
Oct 12, 2017
by
Gant Laborde
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #247 from rizzomichaelg/patch-1
Check for null with getCurrentActivity()
parents
df8db334
1968f802
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
CHANGELOG.md
CHANGELOG.md
+1
-0
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+3
-2
No files found.
CHANGELOG.md
View file @
218d3e97
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
-
Add Android support for serial number, IP, and MAC address (https://github.com/rebeccahughes/react-native-device-info/pull/150)
-
Add Android support for serial number, IP, and MAC address (https://github.com/rebeccahughes/react-native-device-info/pull/150)
-
Add tvOS support (https://github.com/rebeccahughes/react-native-device-info/pull/235)
-
Add tvOS support (https://github.com/rebeccahughes/react-native-device-info/pull/235)
-
Add flow types
-
Add flow types
-
Fix getCurrentActivity() null crash in Android (https://github.com/rebeccahughes/react-native-device-info/pull/247)
[
Diff
](
https://github.com/rebeccahughes/react-native-device-info/compare/1aafc6f0b20d7cd6f0939ea5370e9899e4914c93...master
)
[
Diff
](
https://github.com/rebeccahughes/react-native-device-info/compare/1aafc6f0b20d7cd6f0939ea5370e9899e4914c93...master
)
...
...
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
218d3e97
...
@@ -157,9 +157,10 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
...
@@ -157,9 +157,10 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants
.
put
(
"timezone"
,
TimeZone
.
getDefault
().
getID
());
constants
.
put
(
"timezone"
,
TimeZone
.
getDefault
().
getID
());
constants
.
put
(
"isEmulator"
,
this
.
isEmulator
());
constants
.
put
(
"isEmulator"
,
this
.
isEmulator
());
constants
.
put
(
"isTablet"
,
this
.
isTablet
());
constants
.
put
(
"isTablet"
,
this
.
isTablet
());
if
(
getCurrentActivity
().
checkCallingOrSelfPermission
(
Manifest
.
permission
.
READ_PHONE_STATE
)
==
PackageManager
.
PERMISSION_GRANTED
||
if
(
getCurrentActivity
()
!=
null
&&
(
getCurrentActivity
().
checkCallingOrSelfPermission
(
Manifest
.
permission
.
READ_PHONE_STATE
)
==
PackageManager
.
PERMISSION_GRANTED
||
getCurrentActivity
().
checkCallingOrSelfPermission
(
Manifest
.
permission
.
READ_SMS
)
==
PackageManager
.
PERMISSION_GRANTED
||
getCurrentActivity
().
checkCallingOrSelfPermission
(
Manifest
.
permission
.
READ_SMS
)
==
PackageManager
.
PERMISSION_GRANTED
||
getCurrentActivity
().
checkCallingOrSelfPermission
(
"android.permission.READ_PHONE_NUMBERS"
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
getCurrentActivity
().
checkCallingOrSelfPermission
(
"android.permission.READ_PHONE_NUMBERS"
)
==
PackageManager
.
PERMISSION_GRANTED
)
)
{
TelephonyManager
telMgr
=
(
TelephonyManager
)
this
.
reactContext
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
TelephonyManager
telMgr
=
(
TelephonyManager
)
this
.
reactContext
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
constants
.
put
(
"phoneNumber"
,
telMgr
.
getLine1Number
());
constants
.
put
(
"phoneNumber"
,
telMgr
.
getLine1Number
());
}
}
...
...
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