Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
ec67148a
Commit
ec67148a
authored
Aug 30, 2020
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mac header
parent
c6ac2f2e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
+2
-0
src/main/java/tech/starwin/utils/context_utils/DeviceUtils.java
+8
-4
No files found.
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
View file @
ec67148a
...
@@ -20,6 +20,7 @@ import okhttp3.internal.Util;
...
@@ -20,6 +20,7 @@ import okhttp3.internal.Util;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.context_utils.AppInfoUtils
;
import
tech.starwin.utils.context_utils.AppInfoUtils
;
import
tech.starwin.utils.context_utils.DeviceUtils
;
/**
/**
* Created by XLEO on 2018/1/30.
* Created by XLEO on 2018/1/30.
...
@@ -79,6 +80,7 @@ public class DefaultHeaderAddInterceptor implements Interceptor {
...
@@ -79,6 +80,7 @@ public class DefaultHeaderAddInterceptor implements Interceptor {
.
header
(
"X-APP-SOURCE"
,
LibConfig
.
XH_CHANNEL_NAME
==
null
?
""
:
LibConfig
.
XH_CHANNEL_NAME
)
.
header
(
"X-APP-SOURCE"
,
LibConfig
.
XH_CHANNEL_NAME
==
null
?
""
:
LibConfig
.
XH_CHANNEL_NAME
)
.
header
(
"thirdpartyDataFlag"
,
String
.
valueOf
(!
TextUtils
.
isEmpty
(
LibConfig
.
TONGDUN_PARENT_KEY
)))
.
header
(
"thirdpartyDataFlag"
,
String
.
valueOf
(!
TextUtils
.
isEmpty
(
LibConfig
.
TONGDUN_PARENT_KEY
)))
// .header("X-APP-SIM-MOBILE", getSimInfo())
// .header("X-APP-SIM-MOBILE", getSimInfo())
.
header
(
"X-MAC_ADDRESS"
,
DeviceUtils
.
getInstance
().
getMacAddress
())
.
header
(
"X-AF-ID"
,
LibConfig
.
APPSFLYER_DEV_KEY
==
null
?
""
:
LibConfig
.
APPSFLYER_DEV_KEY
)
.
header
(
"X-AF-ID"
,
LibConfig
.
APPSFLYER_DEV_KEY
==
null
?
""
:
LibConfig
.
APPSFLYER_DEV_KEY
)
.
header
(
"X-GA-ID"
,
getGAId
())
.
header
(
"X-GA-ID"
,
getGAId
())
.
header
(
"X-GP-PKG-FLAG"
,
String
.
valueOf
(!
LibConfig
.
IS_COLLECT_MODE
))
.
header
(
"X-GP-PKG-FLAG"
,
String
.
valueOf
(!
LibConfig
.
IS_COLLECT_MODE
))
...
...
src/main/java/tech/starwin/utils/context_utils/DeviceUtils.java
View file @
ec67148a
...
@@ -489,8 +489,10 @@ public class DeviceUtils {
...
@@ -489,8 +489,10 @@ public class DeviceUtils {
*
*
* @return
* @return
*/
*/
String
MAC
=
"NULL"
;
public
String
getMacAddress
()
{
public
String
getMacAddress
()
{
String
macAddress
=
null
;
if
(
MAC
==
"NULL"
)
{
StringBuffer
buf
=
new
StringBuffer
();
StringBuffer
buf
=
new
StringBuffer
();
NetworkInterface
networkInterface
=
null
;
NetworkInterface
networkInterface
=
null
;
try
{
try
{
...
@@ -499,7 +501,7 @@ public class DeviceUtils {
...
@@ -499,7 +501,7 @@ public class DeviceUtils {
networkInterface
=
NetworkInterface
.
getByName
(
"wlan0"
);
networkInterface
=
NetworkInterface
.
getByName
(
"wlan0"
);
}
}
if
(
networkInterface
==
null
)
{
if
(
networkInterface
==
null
)
{
return
""
;
MAC
=
""
;
}
}
byte
[]
addr
=
networkInterface
.
getHardwareAddress
();
byte
[]
addr
=
networkInterface
.
getHardwareAddress
();
for
(
byte
b
:
addr
)
{
for
(
byte
b
:
addr
)
{
...
@@ -508,11 +510,13 @@ public class DeviceUtils {
...
@@ -508,11 +510,13 @@ public class DeviceUtils {
if
(
buf
.
length
()
>
0
)
{
if
(
buf
.
length
()
>
0
)
{
buf
.
deleteCharAt
(
buf
.
length
()
-
1
);
buf
.
deleteCharAt
(
buf
.
length
()
-
1
);
}
}
macAddress
=
buf
.
toString
();
MAC
=
buf
.
toString
();
}
catch
(
SocketException
e
)
{
}
catch
(
SocketException
e
)
{
MAC
=
""
;
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
macAddress
==
null
?
""
:
macAddress
;
}
return
MAC
;
}
}
...
...
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