Commit bfb8faac authored by mengcuiguang's avatar mengcuiguang

修改deviceId获取方式

parent edc5ac05
...@@ -128,22 +128,21 @@ public class MintsApplication extends MultiDexApplication { ...@@ -128,22 +128,21 @@ public class MintsApplication extends MultiDexApplication {
// 猎豹游戏初始化 // 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk(); LiebaoManager.getInstance().initCmGameSdk();
// 友盟初始化
// initUm(this);
TalkingDataConfig();
} }
/** /**
* 设置TalkingData * 设置TalkingData
*/ */
private void TalkingDataConfig() { public void TalkingDataConfig() {
TCAgent.LOG_ON = BuildConfig.DEBUG; try {
String talkingData_id = CommonUtils.getAppMetaData(MintsApplication.getContext(), "TD_KEY"); TCAgent.LOG_ON = BuildConfig.DEBUG;
String td_channel_id = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"); String talkingData_id = CommonUtils.getAppMetaData(MintsApplication.getContext(), "TD_KEY");
TCAgent.init(this, talkingData_id, td_channel_id); String td_channel_id = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
TCAgent.setReportUncaughtExceptions(true); TCAgent.init(this, talkingData_id, td_channel_id);
TCAgent.setReportUncaughtExceptions(true);
} catch (Exception e) {
e.printStackTrace();
}
} }
/** /**
......
...@@ -103,7 +103,7 @@ class HomePresenter : BasePresenter<HomeView>() { ...@@ -103,7 +103,7 @@ class HomePresenter : BasePresenter<HomeView>() {
*/ */
fun userLogin(type: Int) { fun userLogin(type: Int) {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo), .call(loanService.visitorlogin(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<UserBean>>() {
......
...@@ -63,7 +63,7 @@ class LoginPresenter : BasePresenter<LoginView>() { ...@@ -63,7 +63,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["mobile"] = mobile vo["mobile"] = mobile
vo["smsCode"] = smsCode vo["smsCode"] = smsCode
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.bindingMobile(vo), .call(loanService.bindingMobile(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<UserBean>>() {
...@@ -103,7 +103,7 @@ class LoginPresenter : BasePresenter<LoginView>() { ...@@ -103,7 +103,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
vo["mobile"] = mobile vo["mobile"] = mobile
vo["smsCode"] = smsCode vo["smsCode"] = smsCode
vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.login(vo), .call(loanService.login(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<UserBean>>() {
...@@ -142,7 +142,7 @@ class LoginPresenter : BasePresenter<LoginView>() { ...@@ -142,7 +142,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
view.showLoading("加载中...") view.showLoading("加载中...")
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId vo["shumeiId"] = ShumeiManager.getInstance().shumeiDeviceId
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
vo["wxInfo"] = wxInfo vo["wxInfo"] = wxInfo
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.wechatlogin(vo), .call(loanService.wechatlogin(vo),
......
...@@ -98,7 +98,7 @@ class MainFragmentPresenter : BasePresenter<MainFragmentView>() { ...@@ -98,7 +98,7 @@ class MainFragmentPresenter : BasePresenter<MainFragmentView>() {
fun userLogin() { fun userLogin() {
view.showLoading("加载中...") view.showLoading("加载中...")
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo), .call(loanService.visitorlogin(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<UserBean>>() {
......
...@@ -187,7 +187,7 @@ class MyPresenter : BasePresenter<MyView>() { ...@@ -187,7 +187,7 @@ class MyPresenter : BasePresenter<MyView>() {
*/ */
fun userLogin() { fun userLogin() {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo), .call(loanService.visitorlogin(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<UserBean>>() {
......
...@@ -21,7 +21,7 @@ class PanPresenter : BasePresenter<PanView>() { ...@@ -21,7 +21,7 @@ class PanPresenter : BasePresenter<PanView>() {
*/ */
fun userLogin() { fun userLogin() {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["device"] = DeviceUuidFactory().deviceUuid.toString() vo["device"] = DeviceUuidFactory().deviceUuid
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo), .call(loanService.visitorlogin(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() { object : BaseSubscriber<BaseResponse<UserBean>>() {
......
...@@ -116,6 +116,7 @@ class MainFragment : BaseFragment(), MainFragmentView { ...@@ -116,6 +116,7 @@ class MainFragment : BaseFragment(), MainFragmentView {
private fun uploadDeviceInfo() { private fun uploadDeviceInfo() {
mainFragmentPresenter.comSaveTerminalInfo() mainFragmentPresenter.comSaveTerminalInfo()
baseApplication.initUm(context) baseApplication.initUm(context)
baseApplication.TalkingDataConfig()
} }
private fun showPowerDialog() { private fun showPowerDialog() {
......
...@@ -4,8 +4,10 @@ import android.content.Context; ...@@ -4,8 +4,10 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.mints.fairyland.MintsApplication; import com.mints.fairyland.MintsApplication;
import com.mints.fairyland.common.DeviceInfo;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.UUID; import java.util.UUID;
...@@ -23,7 +25,7 @@ public class DeviceUuidFactory { ...@@ -23,7 +25,7 @@ public class DeviceUuidFactory {
protected static UUID uuid; protected static UUID uuid;
public DeviceUuidFactory() { public DeviceUuidFactory() {
Context context= MintsApplication.getContext(); Context context = MintsApplication.getContext();
if (uuid == null) { if (uuid == null) {
synchronized (DeviceUuidFactory.class) { synchronized (DeviceUuidFactory.class) {
if (uuid == null) { if (uuid == null) {
...@@ -86,7 +88,17 @@ public class DeviceUuidFactory { ...@@ -86,7 +88,17 @@ public class DeviceUuidFactory {
* @return a UUID that may be used to uniquely identify your device for most purposes. * @return a UUID that may be used to uniquely identify your device for most purposes.
* @see //http://code.google.com/p/android/issues/detail?id=10603 * @see //http://code.google.com/p/android/issues/detail?id=10603
*/ */
public UUID getDeviceUuid() { public String getDeviceUuid() {
return uuid; try {
String macAddress = DeviceInfo.Companion.getInstance().getMacAddress();
String mac = macAddress.replace(":", "");
if (!TextUtils.equals(mac, "020000000000")) {
return MD5.GetMD5Code(mac);
}
} catch (Exception e) {
}
return uuid.toString();
} }
} }
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