Commit 7725a4bb by sikang

UPDATE

parent bb2e9d2c
......@@ -8,6 +8,7 @@ import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import tech.starwin.LibConfig;
import tech.starwin.utils.LogUtils;
import tech.starwin.utils.LoginManager;
import tech.starwin.utils.PreferencesManager;
import tech.starwin.utils.collection.UploadManager;
......@@ -18,6 +19,7 @@ import tech.starwin.utils.context_utils.AppInfoUtils;
*/
public class FirebaseHeaderInterceptor implements Interceptor {
public static final String TAG = "FirebaseHeaderInterceptor";
@Override
public Response intercept(Chain chain) throws IOException {
......@@ -28,7 +30,7 @@ public class FirebaseHeaderInterceptor implements Interceptor {
if (newRequest != null) {
Request.Builder builder = chain.request().newBuilder();
LogUtils.d(TAG,"android_id: "+ AppInfoUtils.getAndroidID(LibConfig.getContext()));
builder.addHeader("X-REFERRER", PreferencesManager.get().getInstallReferrer())
.addHeader("X-REFERRER-SDK", PreferencesManager.get().getInstallReferrer())
.addHeader("X-ANDROID-ID", AppInfoUtils.getAndroidID(LibConfig.getContext()));
......
......@@ -157,9 +157,15 @@ public class UploadManager {
uploadException(e, e.getMessage());
} finally {
try {
os.close();
ins.close();
socket.close();
if (os != null) {
os.close();
}
if (ins != null) {
ins.close();
}
if (socket != null) {
socket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
......
......@@ -33,7 +33,6 @@ public class AppInfoUtils {
/**
* 获取AndroidID
*/
@SuppressLint("HardwareIds")
public static String getAndroidID(Context context) {
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