Commit 79889eec authored by xujialang's avatar xujialang

更新-添加输出日志

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