Commit e22e35ec by sikang

add gaid

parent bfe40ef5
......@@ -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'
......
......@@ -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"
......
......@@ -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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment