1.广告位上报接口和对已上报进行Sharedference存储
2.对广告位更新资源对Sharedference进行清除
This commit is contained in:
@@ -27,4 +27,8 @@ public interface ServerApi {
|
||||
@POST(ServerInterface.POST_LAUNCHER_ADS)
|
||||
Call<String> postLauncherAds(@Body RequestBody requestBody);
|
||||
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST(ServerInterface.POST_DOWNLOAD_ADS)
|
||||
Call<String> postDownLoadAds(@Body RequestBody requestBody);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ public class ServerInterface {
|
||||
/**上传事件信息*/
|
||||
public static final String POST_EVENTINFO_DEVICE="/app-api/third/launcher/ad/play/callback";
|
||||
|
||||
public static final String POST_DOWNLOAD_ADS="/app-api/launcher/ad/cb";
|
||||
|
||||
private static final boolean USER_DEBUG=false;
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.android.api.biz;
|
||||
import com.android.api.biz.OnBaseListener;
|
||||
import com.android.database.lib.RecordEventBean;
|
||||
import com.android.nebulasdk.bean.EventDataInfo;
|
||||
import com.android.nebulasdk.bean.UploadADBean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -19,8 +20,8 @@ public interface Biz {
|
||||
void postLauncherAds(Map<String ,String > map, OnBaseListener listener);
|
||||
//记录设备事件的接口
|
||||
void postEventData(List<EventDataInfo> recordEventBeans, OnBaseListener listener);
|
||||
|
||||
|
||||
//上传各个广告位下载状态
|
||||
void postDownloadAd(UploadADBean uploadADBean, OnBaseListener listener);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.android.api.biz.bizimpl;
|
||||
|
||||
import com.android.api.biz.Biz;
|
||||
import com.android.nebulasdk.bean.EventDataInfo;
|
||||
import com.android.nebulasdk.bean.UploadADBean;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.android.api.ServerApi;
|
||||
import com.android.api.biz.BaseBiz;
|
||||
@@ -110,5 +111,38 @@ public class BizImpl extends BaseBiz implements Biz {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDownloadAd(UploadADBean uploadADBean, OnBaseListener listener) {
|
||||
RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), GsonUtil.GsonString(uploadADBean));
|
||||
getStringRetrofit().create(ServerApi.class).postDownLoadAds(requestBody).enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(Call<String> call, Response<String> response) {
|
||||
if(call != null){
|
||||
if (response.body() != null) {
|
||||
LogUtils.loge("postLauncherAds response==>" + GsonUtil.GsonString(response.body()));
|
||||
if (response.isSuccessful()) {
|
||||
listener.onResponse(response.body());
|
||||
} else {
|
||||
listener.onFailure(response.message(), response.raw().code());
|
||||
}
|
||||
} else {
|
||||
listener.onFailure("The server is busy, please try again later", response.raw().code());
|
||||
}
|
||||
}else {
|
||||
LogUtils.loge("postDownloadAd Biz>>>>>>>>>>>>>>>>>>call == null<<<<<<<<<<<<<<<<<<");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<String> call, Throwable t) {
|
||||
if (call.isExecuted()) {
|
||||
call.cancel();
|
||||
}
|
||||
LogUtils.loge("recoedDeviceEvent Biz服务器未响应请求失败==>" + GsonUtil.GsonString(t.getMessage()));
|
||||
listener.onFailure("The server is busy, please try again later", 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user