Commit 7826f50c authored by shiyl's avatar shiyl

友盟统计开启账号统计,并在奔溃时上传手机号

parent 6db4e0c1
...@@ -2,10 +2,14 @@ package com.yidian.bcommon.utils ...@@ -2,10 +2,14 @@ package com.yidian.bcommon.utils
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
import com.orhanobut.hawk.Hawk
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure import com.umeng.commonsdk.UMConfigure
import com.umeng.message.entity.UMessage import com.umeng.message.entity.UMessage
import com.umeng.umcrash.UMCrash
import com.umeng.umcrash.UMCrashCallback
import com.yidian.bcommon.constant.AppConfig import com.yidian.bcommon.constant.AppConfig
import com.yidian.bcommon.constant.HawkConfig
import com.yidian.bcommon.constant.RunConfig import com.yidian.bcommon.constant.RunConfig
import com.yidian.bcommon.constant.XRouterPathConstants import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.xarc.xbase.utils.ChannelUtil import com.yidian.xarc.xbase.utils.ChannelUtil
...@@ -35,73 +39,10 @@ class UMConfigUtils { ...@@ -35,73 +39,10 @@ class UMConfigUtils {
AppConfig.UMTestPushSecret AppConfig.UMTestPushSecret
) )
} }
//
// // todo 分享设置,需要区分环境
// PlatformConfig.setWeixin(AppConfig.WeChatAppKey, AppConfig.WeChatAppSecret)
// PlatformConfig.setWXFileProvider(AppConfig.FileProvider)
// PlatformConfig.setQQZone(AppConfig.QQAppKey, AppConfig.QQAppSecret)
// PlatformConfig.setQQFileProvider(AppConfig.FileProvider)
// PlatformConfig.setSinaWeibo(AppConfig.SinaAppKey, AppConfig.SinaAppSecret, AppConfig.SinaCallBackUrl)
//
// // todo 推送设置,需要区分环境
// val mPushAgent = PushAgent.getInstance(context)
// mPushAgent.register(object : IUmengRegisterCallback {
// override fun onSuccess(deviceToken: String) {
// //注册成功会返回deviceToken deviceToken是推送消息的唯一标志
// Log.i("umpush", "注册成功:deviceToken:--------> $deviceToken")
// Hawk.put(HawkConfig.UmToken, deviceToken)
// addAlias()
// }
//
// private fun addAlias() {
// val token = ToolsUtil.getYDEncryptionToken()
// mPushAgent.addAlias(token, AppConfig.UMType) { isSuccess, message ->
// Log.d("song_test", "addAlias 绑定成功与否 = $isSuccess message = $message")
// }
// }
//
// override fun onFailure(s: String, s1: String) {
// Log.e("umpush", "注册失败:--------> s:$s,s1:$s1")
// }
// })
//
// // 接收自定义消息
// val messageHandler = object : UmengMessageHandler() {
// override fun dealWithCustomMessage(p0: Context?, p1: UMessage?) {
// super.dealWithCustomMessage(p0, p1)
// Log.e("umpush", "dealWithCustomMessage接收自定义消息:--------> ${p1!!.custom}")
// }
// }
//
// val notificationClickHandler: UmengNotificationClickHandler = object : UmengNotificationClickHandler() {
// override fun dealWithCustomAction(context: Context, msg: UMessage) {
// super.dealWithCustomAction(context, msg)
// Toast.makeText(context, msg.custom, Toast.LENGTH_LONG).show()
// Log.e("umpush", "dealWithCustomAction接收消息:--------> ${msg.custom}")
// }
//
// override fun launchApp(p0: Context?, p1: UMessage?) {
// super.launchApp(p0, p1)
// goToJump(p1)
// }
//
// override fun openUrl(p0: Context?, p1: UMessage?) {
// super.openUrl(p0, p1)
// Log.e("umpush", "openUrl接收自定义消息:--------> ${p1!!.custom}")
// }
//
// override fun openActivity(p0: Context?, p1: UMessage?) {
// super.openActivity(p0, p1)
// Log.e("umpush", "openActivity接收自定义消息:--------> ${p1!!.custom}")
// }
//
//
// }
// mPushAgent.notificationClickHandler = notificationClickHandler
// mPushAgent.messageHandler = messageHandler
//选择AUTO页面采集模式,统计SDK基础指标无需手动埋点可自动采集。建议在宿主App的Application.onCreate函数中调用此函数。 //选择AUTO页面采集模式,统计SDK基础指标无需手动埋点可自动采集。建议在宿主App的Application.onCreate函数中调用此函数。
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO)
// 友盟崩溃的回调,上传手机号
UMCrash.registerUMCrashCallback { Hawk.get(HawkConfig.Mobile, "") }
} }
private fun goToJump(p1: UMessage?) { private fun goToJump(p1: UMessage?) {
......
...@@ -4,6 +4,7 @@ import android.os.Bundle ...@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.orhanobut.hawk.Hawk import com.orhanobut.hawk.Hawk
import com.umeng.analytics.MobclickAgent
import com.yidian.bcommon.constant.AppConfig import com.yidian.bcommon.constant.AppConfig
import com.yidian.bcommon.constant.HawkConfig import com.yidian.bcommon.constant.HawkConfig
import com.yidian.bcommon.constant.XRouterPathConstants.Companion.LOGIN_LIFE_CIRCLE import com.yidian.bcommon.constant.XRouterPathConstants.Companion.LOGIN_LIFE_CIRCLE
...@@ -142,6 +143,8 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>(), View.OnFoc ...@@ -142,6 +143,8 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>(), View.OnFoc
Hawk.put(HawkConfig.Mobile, loginResponse.mobile) Hawk.put(HawkConfig.Mobile, loginResponse.mobile)
Hawk.put(HawkConfig.Nickname, loginResponse.nick_name) Hawk.put(HawkConfig.Nickname, loginResponse.nick_name)
Hawk.put(HawkConfig.Avatar, loginResponse.avatar) Hawk.put(HawkConfig.Avatar, loginResponse.avatar)
// 上传用户id到友盟
MobclickAgent.onProfileSignIn(loginResponse.user_id.toString())
// 登录成功后请求生活号列表接口 // 登录成功后请求生活号列表接口
ZapTicket(ZapServiceNameConstants.LifeNumberListService).withAction(ZapServiceActionConstants.ActionRequestList) ZapTicket(ZapServiceNameConstants.LifeNumberListService).withAction(ZapServiceActionConstants.ActionRequestList)
.onResult { result -> .onResult { result ->
...@@ -181,6 +184,8 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>(), View.OnFoc ...@@ -181,6 +184,8 @@ class LoginLifeCircleActivity : BaseActivity<ActivityLoginBinding>(), View.OnFoc
Hawk.put(HawkConfig.LoginStatus, false) Hawk.put(HawkConfig.LoginStatus, false)
// 生活号id // 生活号id
StorageUtil.deleteLifeAccountId() StorageUtil.deleteLifeAccountId()
// 友盟账号统计退出
MobclickAgent.onProfileSignOff()
// 通过服务 清除内存中的认证数据 // 通过服务 清除内存中的认证数据
ZapTicket(ZapServiceNameConstants.LifeNumberListService) ZapTicket(ZapServiceNameConstants.LifeNumberListService)
.withAction(ZapServiceActionConstants.ActionClearAuthenticationData) .withAction(ZapServiceActionConstants.ActionClearAuthenticationData)
......
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