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
a2eefc11
Commit
a2eefc11
authored
Oct 16, 2017
by
Kesha Antonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use wifi info only for 2 funcs
parent
61cdeaa2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+10
-6
No files found.
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
a2eefc11
...
...
@@ -40,10 +40,6 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
super
(
reactContext
);
this
.
reactContext
=
reactContext
;
WifiManager
manager
=
(
WifiManager
)
reactContext
.
getSystemService
(
Context
.
WIFI_SERVICE
);
this
.
wifiInfo
=
manager
.
getConnectionInfo
();
}
@Override
...
...
@@ -51,6 +47,14 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
return
"RNDeviceInfo"
;
}
private
WifiInfo
getWifiInfo
()
{
if
(
this
.
wifiInfo
==
null
)
{
WifiManager
manager
=
(
WifiManager
)
reactContext
.
getSystemService
(
Context
.
WIFI_SERVICE
);
this
.
wifiInfo
=
manager
.
getConnectionInfo
();
}
return
this
.
wifiInfo
;
}
private
String
getCurrentLanguage
()
{
Locale
current
=
getReactApplicationContext
().
getResources
().
getConfiguration
().
locale
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
...
...
@@ -95,13 +99,13 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
@ReactMethod
public
void
getIpAddress
(
Promise
p
)
{
String
ipAddress
=
Formatter
.
formatIpAddress
(
wifiInfo
.
getIpAddress
());
String
ipAddress
=
Formatter
.
formatIpAddress
(
getWifiInfo
()
.
getIpAddress
());
p
.
resolve
(
ipAddress
);
}
@ReactMethod
public
void
getMacAddress
(
Promise
p
)
{
String
macAddress
=
wifiInfo
.
getMacAddress
();
String
macAddress
=
getWifiInfo
()
.
getMacAddress
();
p
.
resolve
(
macAddress
);
}
...
...
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