Commit 4936111e authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent 264335e1
......@@ -69,6 +69,7 @@ android {
buildConfigField "String", "GROMORE_MAIN_EXPRESS_CODE", GROMORE_MAIN_EXPRESS_CODE
buildConfigField "String", "GROMORE_BANNER_CODE", GROMORE_BANNER_CODE
buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID
buildConfigField "String", "RELEASE_TALKING_DATA_KEY", RELEASE_TALKING_DATA_KEY
//混淆
minifyEnabled false
......@@ -92,6 +93,7 @@ android {
buildConfigField "String", "GROMORE_MAIN_EXPRESS_CODE", GROMORE_MAIN_EXPRESS_CODE
buildConfigField "String", "GROMORE_BANNER_CODE", GROMORE_BANNER_CODE
buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID
buildConfigField "String", "RELEASE_TALKING_DATA_KEY", RELEASE_TALKING_DATA_KEY
//混淆
minifyEnabled true
......
......@@ -14,6 +14,7 @@ import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import com.duben.xixiplaylet.manager.TalkingDataManager;
import com.google.android.material.snackbar.Snackbar;
import com.duben.library.utils.CommonUtils;
import com.duben.xixiplaylet.R;
......@@ -106,12 +107,13 @@ public abstract class BaseAppCompatActivity extends TransitionActivity {
@Override
protected void onResume() {
super.onResume();
TalkingDataManager.INSTANCE.onResume(this,getClass().getSimpleName());
}
@Override
protected void onPause() {
super.onPause();
TalkingDataManager.INSTANCE.onPause(this,getClass().getSimpleName());
}
@Override
......
......@@ -12,6 +12,7 @@ import com.downloader.PRDownloaderConfig;
import com.duben.xixiplaylet.ad.TTAdManagerHolder;
import com.duben.xixiplaylet.common.Constant;
import com.duben.xixiplaylet.manager.TXCSDKService;
import com.duben.xixiplaylet.manager.TalkingDataManager;
import com.duben.xixiplaylet.manager.UmengManager;
import com.duben.xixiplaylet.net.LoanService;
import com.duben.xixiplaylet.net.V6Service;
......@@ -77,12 +78,15 @@ public class MintsApplication extends MultiDexApplication {
.getBoolean(Constant.LOAN_PERMISSION_FLAG, true)) return;
initMiitHelper();
TTAdManagerHolder.init(this);
TXCSDKService.init(this);
TalkingDataManager.INSTANCE.init(this);
// 判断应用是否在前台
ForegroundOrBackground.init(this);
......
package com.duben.xixiplaylet.manager
import android.app.Application
import android.content.Context
import com.duben.xixiplaylet.BuildConfig
import com.duben.xixiplaylet.utils.MateUtils
import com.tendcloud.tenddata.TCAgent
/**
* TalkingData
*/
object TalkingDataManager {
private const val APP_KEY =BuildConfig.RELEASE_TALKING_DATA_KEY
fun init(application:Application) {
try {
//打开日志
TCAgent.LOG_ON = BuildConfig.LOG_DEBUG
/**
* 动态获取渠道ID(类似友盟)
* AppID说是xml文件里的密钥?
*/
TCAgent.init(application, APP_KEY
, MateUtils.getAppMetaData(application, "CHANNEL_NAME"))
/**
* true-开启自动捕获错误
*/
TCAgent.setReportUncaughtExceptions(true)
} catch (e: Exception) {
e.printStackTrace()
}
}
fun onResume(cxt:Context,name:String){
TCAgent.onPageStart(cxt, name)
}
fun onPause(cxt:Context,name:String){
TCAgent.onPageEnd(cxt, name)
}
}
\ No newline at end of file
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