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
7725a4bb
Commit
7725a4bb
authored
Dec 31, 2018
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UPDATE
parent
bb2e9d2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
src/main/java/tech/starwin/network/FirebaseHeaderInterceptor.java
+3
-1
src/main/java/tech/starwin/utils/collection/UploadManager.java
+9
-3
src/main/java/tech/starwin/utils/context_utils/AppInfoUtils.java
+0
-1
No files found.
src/main/java/tech/starwin/network/FirebaseHeaderInterceptor.java
View file @
7725a4bb
...
@@ -8,6 +8,7 @@ import okhttp3.Interceptor;
...
@@ -8,6 +8,7 @@ import okhttp3.Interceptor;
import
okhttp3.Request
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
okhttp3.Response
;
import
tech.starwin.LibConfig
;
import
tech.starwin.LibConfig
;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.collection.UploadManager
;
import
tech.starwin.utils.collection.UploadManager
;
...
@@ -18,6 +19,7 @@ import tech.starwin.utils.context_utils.AppInfoUtils;
...
@@ -18,6 +19,7 @@ import tech.starwin.utils.context_utils.AppInfoUtils;
*/
*/
public
class
FirebaseHeaderInterceptor
implements
Interceptor
{
public
class
FirebaseHeaderInterceptor
implements
Interceptor
{
public
static
final
String
TAG
=
"FirebaseHeaderInterceptor"
;
@Override
@Override
public
Response
intercept
(
Chain
chain
)
throws
IOException
{
public
Response
intercept
(
Chain
chain
)
throws
IOException
{
...
@@ -28,7 +30,7 @@ public class FirebaseHeaderInterceptor implements Interceptor {
...
@@ -28,7 +30,7 @@ public class FirebaseHeaderInterceptor implements Interceptor {
if
(
newRequest
!=
null
)
{
if
(
newRequest
!=
null
)
{
Request
.
Builder
builder
=
chain
.
request
().
newBuilder
();
Request
.
Builder
builder
=
chain
.
request
().
newBuilder
();
LogUtils
.
d
(
TAG
,
"android_id: "
+
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()));
builder
.
addHeader
(
"X-REFERRER"
,
PreferencesManager
.
get
().
getInstallReferrer
())
builder
.
addHeader
(
"X-REFERRER"
,
PreferencesManager
.
get
().
getInstallReferrer
())
.
addHeader
(
"X-REFERRER-SDK"
,
PreferencesManager
.
get
().
getInstallReferrer
())
.
addHeader
(
"X-REFERRER-SDK"
,
PreferencesManager
.
get
().
getInstallReferrer
())
.
addHeader
(
"X-ANDROID-ID"
,
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()));
.
addHeader
(
"X-ANDROID-ID"
,
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()));
...
...
src/main/java/tech/starwin/utils/collection/UploadManager.java
View file @
7725a4bb
...
@@ -157,9 +157,15 @@ public class UploadManager {
...
@@ -157,9 +157,15 @@ public class UploadManager {
uploadException
(
e
,
e
.
getMessage
());
uploadException
(
e
,
e
.
getMessage
());
}
finally
{
}
finally
{
try
{
try
{
os
.
close
();
if
(
os
!=
null
)
{
ins
.
close
();
os
.
close
();
socket
.
close
();
}
if
(
ins
!=
null
)
{
ins
.
close
();
}
if
(
socket
!=
null
)
{
socket
.
close
();
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
src/main/java/tech/starwin/utils/context_utils/AppInfoUtils.java
View file @
7725a4bb
...
@@ -33,7 +33,6 @@ public class AppInfoUtils {
...
@@ -33,7 +33,6 @@ public class AppInfoUtils {
/**
/**
* 获取AndroidID
* 获取AndroidID
*/
*/
@SuppressLint
(
"HardwareIds"
)
public
static
String
getAndroidID
(
Context
context
)
{
public
static
String
getAndroidID
(
Context
context
)
{
return
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
ANDROID_ID
);
return
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
ANDROID_ID
);
}
}
...
...
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