Commit bfb8faac authored by mengcuiguang's avatar mengcuiguang

修改deviceId获取方式

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