|
|
@@ -6,15 +6,16 @@ import android.content.Intent;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Looper;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.kfzs.duanduan.datashare.DDProviderHelper;
|
|
|
import com.kfzs.duanduan.datashare.provider.download.DownLoadInfo;
|
|
|
import com.sheep.gamegroup.model.api.BaseMessageConverter;
|
|
|
import com.sheep.gamegroup.util.ConnectAddress;
|
|
|
import com.sheep.gamegroup.util.DeviceUtil;
|
|
|
+import com.sheep.gamegroup.util.NetUtil;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
|
|
|
-import org.json.JSONObject;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
@@ -42,7 +43,6 @@ public class AppAddOrdelReceiver extends BroadcastReceiver {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
String packages = intent.getDataString().replace("package:","");
|
|
|
-
|
|
|
String packageName = intent.getPackage();
|
|
|
final DownLoadInfo downLoadInfo = DDProviderHelper.getInstance()
|
|
|
.getDownloadTaskToPackname(context, packages);
|
|
|
@@ -54,32 +54,11 @@ public class AppAddOrdelReceiver extends BroadcastReceiver {
|
|
|
public void run() {
|
|
|
super.run();
|
|
|
try {
|
|
|
- OkHttpClient client = new OkHttpClient();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("device_id",DeviceUtil.getDeviceId(SheepApp.mContext)+"");
|
|
|
jsonObject.put("id",downLoadInfo.getMGameID());
|
|
|
- //加密--RequestBody.create(MediaType.parse("org/json; charset=utf-8"), jsonObject.toString())
|
|
|
- String newJsonParams = BaseMessageConverter.encrypt(jsonObject.toString());
|
|
|
-
|
|
|
-
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(ConnectAddress.APP_URL+"/v1/app/accepted_task/download_task_notify/")
|
|
|
- .addHeader("Authorization", SpUtils.getOpenId(SheepApp.mContext)+"")
|
|
|
- .addHeader("X-Device-Id", DeviceUtil.getDeviceId(SheepApp.mContext)+"")
|
|
|
- .put(RequestBody.create(MediaType.parse("org/json; charset=utf-8"), newJsonParams))
|
|
|
- .build();
|
|
|
- client.newCall(request)
|
|
|
- .enqueue(new Callback() {
|
|
|
- @Override
|
|
|
- public void onFailure(Call call, IOException e) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onResponse(Call call, Response response) throws IOException {
|
|
|
+ NetUtil.getNetUtil().sendAppDownload(context, jsonObject);
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|