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
e22e35ec
Commit
e22e35ec
authored
Nov 29, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add gaid
parent
bfe40ef5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
+28
-21
build.gradle
+3
-1
src/main/AndroidManifest.xml
+2
-1
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
+23
-19
No files found.
build.gradle
View file @
e22e35ec
...
...
@@ -156,11 +156,13 @@ dependencies {
// api 'com.google.android.gms:play-services-auth-api-phone:15.0.1'
// api 'com.google.android.gms:play-services-ads:15.0.1'
//
api 'com.google.android.gms:play-services-analytics:17.0.0'
api
'com.google.android.gms:play-services-analytics:17.0.0'
//facebook accountKit SDK
api
'com.facebook.android:account-kit-sdk:5.+'
// api 'com.google.android.gms:play-services-basement:17.1.1'
//SDK-FACEBOOK-START
api
'com.facebook.android:facebook-android-sdk:5.5.1'
...
...
src/main/AndroidManifest.xml
View file @
e22e35ec
...
...
@@ -38,7 +38,8 @@
<!--<uses-permission android:name="android.permission.WAKE_LOCK" />-->
<application
android:networkSecurityConfig=
"@xml/network_security_config"
>
<application
android:networkSecurityConfig=
"@xml/network_security_config"
>
<!--适应全面屏-->
<meta-data
android:name=
"android.max_aspect"
...
...
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
View file @
e22e35ec
...
...
@@ -4,6 +4,10 @@ package tech.starwin.network;
import
android.text.TextUtils
;
import
com.google.android.gms.ads.identifier.AdvertisingIdClient
;
import
com.google.android.gms.common.GooglePlayServicesNotAvailableException
;
import
com.google.android.gms.common.GooglePlayServicesRepairableException
;
import
java.io.IOException
;
import
okhttp3.Interceptor
;
...
...
@@ -69,7 +73,7 @@ class DefaultHeaderAddInterceptor implements Interceptor {
.
header
(
"thirdpartyDataFlag"
,
String
.
valueOf
(!
TextUtils
.
isEmpty
(
LibConfig
.
TONGDUN_PARENT_KEY
)))
// .header("X-APP-SIM-MOBILE", getSimInfo())
.
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-APP-CODE-VERSION"
,
"ID_V2"
);
...
...
@@ -94,24 +98,24 @@ class DefaultHeaderAddInterceptor implements Interceptor {
// return SIM_INFO;
// }
//
private String getGAId() {
//
if (!TextUtils.isEmpty(GA_ID)) {
//
return GA_ID;
//
}
//
AdvertisingIdClient.Info adInfo = null;
//
try {
//
adInfo = AdvertisingIdClient.getAdvertisingIdInfo(LibConfig.getContext());
//
GA_ID = adInfo.getId();
//
} catch (IOException e) {
//
// Unrecoverable error connecting to Google Play services (e.g.,
//
// the old version of the service doesn't support getting AdvertisingId).
//
} catch (GooglePlayServicesNotAvailableException e) {
//
// Google Play services is not available entirely.
//
} catch (GooglePlayServicesRepairableException e) {
//
e.printStackTrace();
//
}
//
return GA_ID;
//
}
private
String
getGAId
()
{
if
(!
TextUtils
.
isEmpty
(
GA_ID
))
{
return
GA_ID
;
}
AdvertisingIdClient
.
Info
adInfo
=
null
;
try
{
adInfo
=
AdvertisingIdClient
.
getAdvertisingIdInfo
(
LibConfig
.
getContext
());
GA_ID
=
adInfo
.
getId
();
}
catch
(
IOException
e
)
{
// Unrecoverable error connecting to Google Play services (e.g.,
// the old version of the service doesn't support getting AdvertisingId).
}
catch
(
GooglePlayServicesNotAvailableException
e
)
{
// Google Play services is not available entirely.
}
catch
(
GooglePlayServicesRepairableException
e
)
{
e
.
printStackTrace
();
}
return
GA_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