Commit 79889eec authored by xujialang's avatar xujialang

更新-添加输出日志

parent c8b3abe2
......@@ -2,6 +2,8 @@ package com.zl.sdk;
import android.text.TextUtils;
import com.zl.sdk.util.LogUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
......@@ -17,6 +19,7 @@ public class NameInterfaceHelp {
}
public static void setClassPath(String class_Path) {
LogUtil.d("OutShow 初始化:中间类路径:" + class_Path);
Class_Path = class_Path;
}
......
......@@ -9,8 +9,6 @@ import android.content.IntentFilter;
import com.zl.sdk.ad.topOn.TopOnAdManager;
import com.zl.sdk.bean.AdAppInfo;
import com.zl.sdk.bean.IconOpt;
import com.zl.sdk.data.DataManager;
import com.zl.sdk.icon.IcOptManager;
import com.zl.sdk.icon.IconHelp;
import com.zl.sdk.out.ActionFrom;
......@@ -63,10 +61,16 @@ public final class OutHelp implements KPListener {
this.isDebug = isDebug;
this.sdkName = sdkName;
NameInterfaceHelp.setClassPath(nameInterfacePath);
LogUtil.d(TAG + "初始化 isDebug=" + isDebug);
LogUtil.d(TAG + "初始化 appId=" + appId);
LogUtil.d(TAG + "初始化 appKey=" + appKey);
LogUtil.d(TAG + "初始化 sdkName=" + sdkName);
LogUtil.d(TAG + "初始化 nameInterfacePath=" + nameInterfacePath);
LogUtil.addObserver(new LogToLogcat());
NameInterfaceHelp.setClassPath(nameInterfacePath);
//初始化广告SDK
AdAppInfo appInfo = new AdAppInfo(appId, appKey);
TopOnAdManager.get().initSDK(context, appInfo);
......@@ -87,6 +91,7 @@ public final class OutHelp implements KPListener {
private Timer timer;
private void initTimer() {
LogUtil.d(TAG + "初始化:initTimer");
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
......@@ -97,10 +102,11 @@ public final class OutHelp implements KPListener {
firstLx = false;
}
}
}, 0,60 * 1000);
}, 0, 60 * 1000);
}
private void initReceiver() {
LogUtil.d(TAG + "初始化:initReceiver");
TriggerReceiver triggerReceiver = new TriggerReceiver();
IntentFilter intentfilter = new IntentFilter();
intentfilter.addAction(Intent.ACTION_USER_PRESENT);
......@@ -116,6 +122,7 @@ public final class OutHelp implements KPListener {
* @param actionFrom 动作来源
*/
public void showOutAd(ActionFrom actionFrom) {
LogUtil.d(TAG + "showOutAd(解锁)actionFrom=" + actionFrom);
OutAdManager.get().startShowOutAd(actionFrom);
}
......@@ -126,6 +133,7 @@ public final class OutHelp implements KPListener {
* @param isFirst 是否第一次检查
*/
private void showOutAd(boolean isFirst) {
LogUtil.d(TAG + "showOutAd(轮询) isFirst=" + isFirst);
OutAdManager.get().checkShowOutAd(isFirst);
}
......@@ -161,19 +169,22 @@ public final class OutHelp implements KPListener {
*/
@Override
public boolean isInit() {
LogUtil.d(TAG + "isInit");
LogUtil.d(TAG + "获取保活 isInit");
try {
Class<?> kpClass = Class.forName(NameInterfaceHelp.getClassPath());
Method isInitMethod = kpClass.getMethod(NameInterfaceHelp.GetKPInitMethod);
Object isInit = isInitMethod.invoke(null);
if (isInit != null) {
LogUtil.d(TAG + "获取保活: isInit=" + isInit);
return (boolean) isInit;
} else {
LogUtil.d(TAG + "获取保活:(null) isInit=false");
return false;
}
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException e) {
LogUtil.d(TAG + "获取保活:(catch) isInit=false");
return false;
}
}
......@@ -184,19 +195,22 @@ public final class OutHelp implements KPListener {
*/
@Override
public boolean iconIsHide() {
LogUtil.d(TAG + "iconIsHide");
LogUtil.d(TAG + "获取icon状态:iconIsHide");
try {
Class<?> kpClass = Class.forName(NameInterfaceHelp.getClassPath());
Method isHideMethod = kpClass.getMethod(NameInterfaceHelp.GetIconStateMethod);
Object isHide = isHideMethod.invoke(null);
if (isHide != null) {
LogUtil.d(TAG + "获取icon状态: isHide=" + isHide);
return (boolean) isHide;
} else {
LogUtil.d(TAG + "获取icon状态:(null) isHide=false");
return false;
}
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException e) {
LogUtil.d(TAG + "获取icon状态:(catch) isHide=false");
return false;
}
}
......@@ -209,19 +223,22 @@ public final class OutHelp implements KPListener {
*/
@Override
public boolean isAppForeground() {
LogUtil.d(TAG + "isAppForeground");
LogUtil.d(TAG + "获取前后台:isAppForeground");
try {
Class<?> kpClass = Class.forName(NameInterfaceHelp.getClassPath());
Method clsMethod = kpClass.getMethod(NameInterfaceHelp.GetAppRunForegroundMethod);
Object isAppInFront = clsMethod.invoke(null);
if (isAppInFront != null) {
LogUtil.d(TAG + "获取前后台: isAppInFront=" + isAppInFront);
return (boolean) isAppInFront;
} else {
LogUtil.d(TAG + "获取前后台:(null) isAppInFront=false");
return false;
}
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException e) {
LogUtil.d(TAG + "获取前后台:(catch) isAppInFront=false");
return false;
}
}
......@@ -233,7 +250,7 @@ public final class OutHelp implements KPListener {
*/
@Override
public void startOutDialog(Intent intent, DialogShowStatusCallback callback) {
LogUtil.d(TAG + "startOutDialog");
LogUtil.d(TAG + "拉起外展");
try {
Class<?> fgClass = Class.forName(NameInterfaceHelp.getFGClassPath());
......@@ -269,6 +286,7 @@ public final class OutHelp implements KPListener {
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException | InstantiationException e) {
LogUtil.d(TAG + "拉起外展:(catch) fail=" + e);
if (callback != null) {
callback.fail("执行失败");
}
......@@ -317,11 +335,15 @@ public final class OutHelp implements KPListener {
public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
if (callback != null) {
if ("onSuccess".equals(method.getName()) || objects.length == 1) {
LogUtil.d(TAG + "拉起外展:onSuccess");
callback.success();
} else if ("onFail".equals(method.getName()) || objects.length == 2) {
LogUtil.d(TAG + "拉起外展:onFail");
if (objects.length >= 2) {
LogUtil.d(TAG + "拉起外展:onFail reason=" + objects[1]);
callback.fail((String) objects[1]);
} else {
LogUtil.d(TAG + "拉起外展:onFail reason=unknown");
callback.fail("unknown");
}
}
......@@ -339,16 +361,16 @@ public final class OutHelp implements KPListener {
String action = intent.getAction();
switch (action) {
case Intent.ACTION_USER_PRESENT: {
LogUtil.d("OutShow ===>>> 解锁");
LogUtil.d(TAG + "===>>> 解锁");
OutHelp.get().showOutAd(ActionFrom.ACTION_USER_PRESENT);
break;
}
case Intent.ACTION_SCREEN_ON: {
LogUtil.d("OutShow ===>>> 亮屏");
LogUtil.d(TAG + "===>>> 亮屏");
break;
}
case Intent.ACTION_CLOSE_SYSTEM_DIALOGS: {
LogUtil.d("OutShow ===>>> 桌面");
LogUtil.d(TAG + "===>>> 桌面");
break;
}
default: {
......
......@@ -26,8 +26,10 @@ public class TopOnAdManager {
return;
}
LogUtil.d(TAG + "初始化:topon应用信息:" + appInfo);
//SDK日志功能,集成测试阶段建议开启,上线前必须关闭
ATSDK.setNetworkLogDebug(false);
ATSDK.setNetworkLogDebug(true);
// //检查广告平台的集成状态,提交审核时需注释此API
// ATSDK.integrationChecking(context);
//
......
......@@ -8,4 +8,12 @@ public class AdAppInfo {
this.app_id = app_id;
this.app_key = app_key;
}
@Override
public String toString() {
return "AdAppInfo{" +
"app_id='" + app_id + '\'' +
", app_key='" + app_key + '\'' +
'}';
}
}
......@@ -82,6 +82,8 @@ public class IcOptManager {
return;
}
LogUtil.d(TAG + "初始化:IcOptManager");
this.context = context.getApplicationContext();
screenBroadcastReceiver = new ScreenBroadcastReceiver();
IntentFilter intentFilter = new IntentFilter();
......
......@@ -54,7 +54,7 @@ public class IconHelp {
public void init() {
iconHide = OutHelp.get().iconIsHide();
LogUtil.d(TAG + "检查icon状态: iconHide=" + iconHide);
LogUtil.d(TAG + "初始化:检查icon状态 iconHide=" + iconHide);
if (iconHide) {
iconHadHide();
......
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