Commit a9812b44 authored by zxhljwl's avatar zxhljwl

修改

parent c03b08a2
...@@ -4,9 +4,9 @@ import android.content.BroadcastReceiver; ...@@ -4,9 +4,9 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
public class AppInstallReceive extends BroadcastReceiver { public class AppInstallReceive extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent!=null){ if (intent!=null){
...@@ -14,7 +14,7 @@ public class AppInstallReceive extends BroadcastReceiver { ...@@ -14,7 +14,7 @@ public class AppInstallReceive extends BroadcastReceiver {
if (TextUtils.equals(intent.getAction(),Intent.ACTION_PACKAGE_ADDED)){ if (TextUtils.equals(intent.getAction(),Intent.ACTION_PACKAGE_ADDED)){
String packageName = intent.getData().getSchemeSpecificPart(); String packageName = intent.getData().getSchemeSpecificPart();
if (!TextUtils.isEmpty(packageName)) { if (!TextUtils.isEmpty(packageName)) {
for (int i =0;i<ZXHCConstant.adList.size();i++){ for (int i = 0; i < ZXHCConstant.adList.size(); i++){
if (packageName.equals(ZXHCConstant.adList.get(i).getPackage_name())){ if (packageName.equals(ZXHCConstant.adList.get(i).getPackage_name())){
InstallFinishReport(ZXHCConstant.adList.get(i)); InstallFinishReport(ZXHCConstant.adList.get(i));
ZXHCConstant.adList.remove(i); ZXHCConstant.adList.remove(i);
...@@ -35,8 +35,6 @@ public class AppInstallReceive extends BroadcastReceiver { ...@@ -35,8 +35,6 @@ public class AppInstallReceive extends BroadcastReceiver {
} }
// intent.getAction() // intent.getAction()
} }
} }
private void InstallFinishReport(HcAdBean adBean) { private void InstallFinishReport(HcAdBean adBean) {
...@@ -45,6 +43,5 @@ public class AppInstallReceive extends BroadcastReceiver { ...@@ -45,6 +43,5 @@ public class AppInstallReceive extends BroadcastReceiver {
HttpClientUtils.GetEvent(adBean.getFinishInstallmonitorUrls().get(i)); HttpClientUtils.GetEvent(adBean.getFinishInstallmonitorUrls().get(i));
} }
} }
} }
} }
...@@ -73,6 +73,9 @@ public class HcAdBean implements Serializable { ...@@ -73,6 +73,9 @@ public class HcAdBean implements Serializable {
private List<String> video_skip; private List<String> video_skip;
private List<String> video_close; private List<String> video_close;
//上报标识,避免重复上报
private boolean isReportInstallStart = false;
private boolean isReportInstallFinish = false;
public boolean isClickDpLinkSucReport() { public boolean isClickDpLinkSucReport() {
...@@ -575,4 +578,20 @@ public class HcAdBean implements Serializable { ...@@ -575,4 +578,20 @@ public class HcAdBean implements Serializable {
public void setVideo_close(List<String> video_close) { public void setVideo_close(List<String> video_close) {
this.video_close = video_close; this.video_close = video_close;
} }
public boolean isReportInstallStart() {
return isReportInstallStart;
}
public void setReportInstallStart(boolean reportInstallStart) {
isReportInstallStart = reportInstallStart;
}
public boolean isReportInstallFinish() {
return isReportInstallFinish;
}
public void setReportInstallFinish(boolean reportInstallFinish) {
isReportInstallFinish = reportInstallFinish;
}
} }
...@@ -31,10 +31,6 @@ public class HcDownLoadUtils { ...@@ -31,10 +31,6 @@ public class HcDownLoadUtils {
public HcDownLoadUtils(Activity activity) { public HcDownLoadUtils(Activity activity) {
this.activity = activity; this.activity = activity;
//注册广播监测下载情况
activity.registerReceiver(receiver,
new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
this.downloadManager = (DownloadManager) HcAppliContext.get().getSystemService(DOWNLOAD_SERVICE);
} }
//下载apk //下载apk
...@@ -55,6 +51,10 @@ public class HcDownLoadUtils { ...@@ -55,6 +51,10 @@ public class HcDownLoadUtils {
} }
} }
//注册广播监测下载情况
activity.registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
this.downloadManager = (DownloadManager) HcAppliContext.get().getSystemService(DOWNLOAD_SERVICE);
//创建下载任务 //创建下载任务
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(adBean.getDown_url().trim())); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(adBean.getDown_url().trim()));
// DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://203.187.160.132:9011/qd.shouji.qihucdn.com/c3pr90ntc0td/nqapk/sjzs2_100000003_5f1aaeb8c462450478/201012/d1208503899d47cab3251dfaa06aaf95/appstore-300090091.apk")); // DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://203.187.160.132:9011/qd.shouji.qihucdn.com/c3pr90ntc0td/nqapk/sjzs2_100000003_5f1aaeb8c462450478/201012/d1208503899d47cab3251dfaa06aaf95/appstore-300090091.apk"));
...@@ -142,7 +142,6 @@ public class HcDownLoadUtils { ...@@ -142,7 +142,6 @@ public class HcDownLoadUtils {
} }
} }
private void installAPK(HcAdBean adBean) { private void installAPK(HcAdBean adBean) {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
// 由于没有在Activity环境下启动Activity,设置下面的标签 // 由于没有在Activity环境下启动Activity,设置下面的标签
...@@ -159,18 +158,22 @@ public class HcDownLoadUtils { ...@@ -159,18 +158,22 @@ public class HcDownLoadUtils {
intent.setDataAndType(Uri.fromFile(new File(Environment.DIRECTORY_DOWNLOADS, adBean.getApp_name())), "application/vnd.android.package-archive"); intent.setDataAndType(Uri.fromFile(new File(Environment.DIRECTORY_DOWNLOADS, adBean.getApp_name())), "application/vnd.android.package-archive");
} }
activity.startActivity(intent); activity.startActivity(intent);
InstallStartReport(adBean); //判断是否上报过“开始安装”
for (int i = 0; i < ZXHCConstant.adList.size(); i++) {
if (ZXHCConstant.adList.get(i).getReq_id().equals(adBean.getReq_id()) &&
!ZXHCConstant.adList.get(i).isReportInstallStart()) {
ZXHCConstant.adList.get(i).setReportInstallStart(true);
InstallStartReport(adBean);
}
}
} }
private void DownLoadSuccessReport(HcAdBean adBean) { private void DownLoadSuccessReport(HcAdBean adBean) {
if (adBean.getFinishdownloadmonitorUrls() != null && adBean.getFinishdownloadmonitorUrls().size() > 0) { if (adBean.getFinishdownloadmonitorUrls() != null && adBean.getFinishdownloadmonitorUrls().size() > 0) {
for (int i = 0; i < adBean.getFinishdownloadmonitorUrls().size(); i++) { for (int i = 0; i < adBean.getFinishdownloadmonitorUrls().size(); i++) {
HttpClientUtils.GetEvent(adBean.getFinishdownloadmonitorUrls().get(i)); HttpClientUtils.GetEvent(adBean.getFinishdownloadmonitorUrls().get(i));
} }
} }
} }
private void DownLoadStartReport(HcAdBean adBean) { private void DownLoadStartReport(HcAdBean adBean) {
...@@ -188,6 +191,4 @@ public class HcDownLoadUtils { ...@@ -188,6 +191,4 @@ public class HcDownLoadUtils {
} }
} }
} }
} }
...@@ -149,14 +149,6 @@ public class RewardVideoMediaPlayer { ...@@ -149,14 +149,6 @@ public class RewardVideoMediaPlayer {
public void startVideo() { public void startVideo() {
if (isPrepared) {//资源加载完成 if (isPrepared) {//资源加载完成
isShowVideo = false; isShowVideo = false;
if (null != mShowListener) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
mShowListener.OnAdShow();
}
});
}
if (null != updateViewListener) { if (null != updateViewListener) {
updateViewListener.OnShowListener(); updateViewListener.OnShowListener();
} }
...@@ -379,7 +371,6 @@ public class RewardVideoMediaPlayer { ...@@ -379,7 +371,6 @@ public class RewardVideoMediaPlayer {
} }
} }
/** /**
* 点击上报 * 点击上报
*/ */
...@@ -398,6 +389,20 @@ public class RewardVideoMediaPlayer { ...@@ -398,6 +389,20 @@ public class RewardVideoMediaPlayer {
} }
} }
/**
* C#展现上报
*/
public void reportVideoShow() {
if (null != mShowListener) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
mShowListener.OnAdShow();
}
});
}
}
/** /**
* 曝光上报 * 曝光上报
*/ */
...@@ -414,5 +419,4 @@ public class RewardVideoMediaPlayer { ...@@ -414,5 +419,4 @@ public class RewardVideoMediaPlayer {
} }
} }
} }
} }
...@@ -51,6 +51,7 @@ public class RewardVideoPortraitADActivity extends Activity implements SurfaceHo ...@@ -51,6 +51,7 @@ public class RewardVideoPortraitADActivity extends Activity implements SurfaceHo
setContentView(R.layout.activity_rewardvideo_portrait_a_d); setContentView(R.layout.activity_rewardvideo_portrait_a_d);
bindViews(); bindViews();
RewardVideoMediaPlayer.getInstance().setRewardVideoUpdateListener(this);//设置播放回调监听,更新Activity View RewardVideoMediaPlayer.getInstance().setRewardVideoUpdateListener(this);//设置播放回调监听,更新Activity View
RewardVideoMediaPlayer.getInstance().reportVideoShow();
RewardVideoMediaPlayer.getInstance().VideoShowReport(); RewardVideoMediaPlayer.getInstance().VideoShowReport();
} }
......
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