Commit 7725a4bb by sikang

UPDATE

parent bb2e9d2c
...@@ -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()));
......
...@@ -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 {
if (os != null) {
os.close(); os.close();
}
if (ins != null) {
ins.close(); ins.close();
}
if (socket != null) {
socket.close(); socket.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -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);
} }
......
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