1.获取OAID,IMEI.2.友盟SDK升级,bugfix
This commit is contained in:
@@ -144,7 +144,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
staging {
|
staging {
|
||||||
buildConfigField "String", "BASE_URL", "\"https://preview.qxjiaoyou.com/\""
|
buildConfigField "String", "BASE_URL", "\"https://api.zhongjialx.com/\""
|
||||||
buildConfigField "String", "BASE_URL_DEBUG", "BASE_URL"
|
buildConfigField "String", "BASE_URL_DEBUG", "BASE_URL"
|
||||||
buildConfigField "String", "BASE_URL_STAGING", "BASE_URL"
|
buildConfigField "String", "BASE_URL_STAGING", "BASE_URL"
|
||||||
buildConfigField "String", "BASE_URL_RELEASE", "BASE_URL"
|
buildConfigField "String", "BASE_URL_RELEASE", "BASE_URL"
|
||||||
@@ -286,6 +286,8 @@ dependencies {
|
|||||||
implementation(name: 'CTAccount_sdk_api_v3.7.0_all', ext: 'aar')
|
implementation(name: 'CTAccount_sdk_api_v3.7.0_all', ext: 'aar')
|
||||||
|
|
||||||
implementation 'com.github.fodroid:XRadioGroup:v1.5'
|
implementation 'com.github.fodroid:XRadioGroup:v1.5'
|
||||||
|
implementation files('libs/miit_mdid_1.0.10.aar')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
BIN
app/libs/miit_mdid_1.0.10.aar
Normal file
BIN
app/libs/miit_mdid_1.0.10.aar
Normal file
Binary file not shown.
1
app/proguard-rules.pro
vendored
1
app/proguard-rules.pro
vendored
@@ -341,6 +341,7 @@
|
|||||||
public <methods>;
|
public <methods>;
|
||||||
public <fields>;
|
public <fields>;
|
||||||
}
|
}
|
||||||
|
-keep class com.bun.miitmdid.core.** {*;}
|
||||||
-dontwarn com.sdk.**
|
-dontwarn com.sdk.**
|
||||||
-keep class com.sdk.** { *;}
|
-keep class com.sdk.** { *;}
|
||||||
-dontwarn io.realm.**
|
-dontwarn io.realm.**
|
||||||
|
@@ -22,9 +22,7 @@
|
|||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
android:name="android.permission.READ_PHONE_STATE"
|
|
||||||
tools:node="remove" />
|
|
||||||
|
|
||||||
<!-- 云信权限声明 -->
|
<!-- 云信权限声明 -->
|
||||||
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
|
||||||
|
17
app/src/main/assets/supplierconfig.json
Normal file
17
app/src/main/assets/supplierconfig.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"supplier":{
|
||||||
|
"vivo":{
|
||||||
|
"appid":"100215079"
|
||||||
|
},
|
||||||
|
"xiaomi":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"huawei":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"oppo":{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -16,12 +16,14 @@ import android.text.TextUtils;
|
|||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
|
|
||||||
import com.alibaba.security.rp.RPSDK;
|
import com.alibaba.security.rp.RPSDK;
|
||||||
import com.alipay.sdk.app.EnvUtils;
|
import com.alipay.sdk.app.EnvUtils;
|
||||||
import com.baidu.mobstat.StatService;
|
import com.baidu.mobstat.StatService;
|
||||||
import com.bumptech.glide.request.target.ViewTarget;
|
import com.bumptech.glide.request.target.ViewTarget;
|
||||||
|
import com.bun.miitmdid.core.JLibrary;
|
||||||
import com.coorchice.library.utils.LogUtils;
|
import com.coorchice.library.utils.LogUtils;
|
||||||
import com.ishumei.smantifraud.SmAntiFraud;
|
import com.ishumei.smantifraud.SmAntiFraud;
|
||||||
import com.llew.huawei.verifier.LoadedApkHuaWei;
|
import com.llew.huawei.verifier.LoadedApkHuaWei;
|
||||||
@@ -55,6 +57,7 @@ import com.yizhuan.erban.R;
|
|||||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||||
import com.yizhuan.erban.radish.wallet.RadishWalletManager;
|
import com.yizhuan.erban.radish.wallet.RadishWalletManager;
|
||||||
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
|
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
|
||||||
|
import com.yizhuan.erban.utils.MiitHelper;
|
||||||
import com.yizhuan.erban.utils.PushMessageHandler;
|
import com.yizhuan.erban.utils.PushMessageHandler;
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||||
import com.yizhuan.xchat_android_core.Constants;
|
import com.yizhuan.xchat_android_core.Constants;
|
||||||
@@ -114,7 +117,30 @@ public class XChatApplication extends Application {
|
|||||||
public static final String TAG = "XChatApplication";
|
public static final String TAG = "XChatApplication";
|
||||||
private static XChatApplication instance;
|
private static XChatApplication instance;
|
||||||
private RefWatcher mRefWatcher;
|
private RefWatcher mRefWatcher;
|
||||||
|
private static String oaid;
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isSupportOaid=true;
|
||||||
|
private static int errorCode;
|
||||||
|
|
||||||
|
public static String getOaid() {
|
||||||
|
return oaid;
|
||||||
|
}
|
||||||
|
public static String getErrorCode() {
|
||||||
|
return String.valueOf(errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSupportOaid() {
|
||||||
|
return isSupportOaid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setIsSupportOaid(boolean isSupportOaid) {
|
||||||
|
XChatApplication.isSupportOaid = isSupportOaid;
|
||||||
|
}
|
||||||
|
public static void setIsSupportOaid(boolean isSupportOaid,int ErrorCode) {
|
||||||
|
XChatApplication.isSupportOaid = isSupportOaid;
|
||||||
|
XChatApplication.errorCode=ErrorCode;
|
||||||
|
}
|
||||||
public static XChatApplication instance() {
|
public static XChatApplication instance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
@@ -204,9 +230,19 @@ public class XChatApplication extends Application {
|
|||||||
|
|
||||||
}
|
}
|
||||||
dealHuaWeiCrash();
|
dealHuaWeiCrash();
|
||||||
|
//获取OAID等设备标识符
|
||||||
|
MiitHelper miitHelper = new MiitHelper(appIdsUpdater);
|
||||||
|
miitHelper.getDeviceIds(getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MiitHelper.AppIdsUpdater appIdsUpdater = new MiitHelper.AppIdsUpdater() {
|
||||||
|
@Override
|
||||||
|
public void OnIdsAvalid(@NonNull String ids) {
|
||||||
|
Log.e("++++++ids: ", ids);
|
||||||
|
oaid = ids;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化linkedMe
|
* 初始化linkedMe
|
||||||
*/
|
*/
|
||||||
@@ -257,6 +293,7 @@ public class XChatApplication extends Application {
|
|||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
// you must install multiDex whatever tinker is installed!
|
// you must install multiDex whatever tinker is installed!
|
||||||
MultiDex.install(base);
|
MultiDex.install(base);
|
||||||
|
JLibrary.InitEntry(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -52,10 +52,10 @@ public class MyCarAdapter extends BaseAdapter<CarInfo> {
|
|||||||
// 时间
|
// 时间
|
||||||
if (remainingDay >= 0 && status == CarInfo.STATUS_USER_CAN_USE) {
|
if (remainingDay >= 0 && status == CarInfo.STATUS_USER_CAN_USE) {
|
||||||
String days;
|
String days;
|
||||||
if (item.getExpireDays() > 99){
|
if (item.getRemainingDay() > 99){
|
||||||
days = item.getExpireDays()+"+";
|
days = item.getRemainingDay()+"+";
|
||||||
}else {
|
}else {
|
||||||
days = item.getExpireDays()+"";
|
days = item.getRemainingDay()+"";
|
||||||
}
|
}
|
||||||
binding.tvCounters.setText(String.format(binding.tvCounters.getResources().getString(R.string.decoration_status_wrapper),
|
binding.tvCounters.setText(String.format(binding.tvCounters.getResources().getString(R.string.decoration_status_wrapper),
|
||||||
binding.tvCounters.getResources().getString(R.string.decoration_remainder) + days + "天"));
|
binding.tvCounters.getResources().getString(R.string.decoration_remainder) + days + "天"));
|
||||||
|
100
app/src/main/java/com/yizhuan/erban/utils/MiitHelper.java
Normal file
100
app/src/main/java/com/yizhuan/erban/utils/MiitHelper.java
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
package com.yizhuan.erban.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.bun.miitmdid.core.ErrorCode;
|
||||||
|
import com.bun.miitmdid.core.IIdentifierListener;
|
||||||
|
import com.bun.miitmdid.core.MdidSdk;
|
||||||
|
import com.bun.miitmdid.core.MdidSdkHelper;
|
||||||
|
import com.bun.miitmdid.supplier.IdSupplier;
|
||||||
|
import com.yizhuan.erban.application.XChatApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zheng on 2019/8/22.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MiitHelper implements IIdentifierListener {
|
||||||
|
|
||||||
|
private AppIdsUpdater _listener;
|
||||||
|
|
||||||
|
public MiitHelper(AppIdsUpdater callback) {
|
||||||
|
_listener = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void getDeviceIds(Context cxt) {
|
||||||
|
long timeb = System.currentTimeMillis();
|
||||||
|
int nres = CallFromReflect(cxt);
|
||||||
|
// int nres=DirectCall(cxt);
|
||||||
|
long timee = System.currentTimeMillis();
|
||||||
|
long offset = timee - timeb;
|
||||||
|
if (nres == ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT) {//1008612 不支持的设备
|
||||||
|
XChatApplication.setIsSupportOaid(false, nres);
|
||||||
|
} else if (nres == ErrorCode.INIT_ERROR_LOAD_CONFIGFILE) {//1008613 加载配置文件出错
|
||||||
|
XChatApplication.setIsSupportOaid(false, nres);
|
||||||
|
} else if (nres == ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT) {//1008611 不支持的设备厂商
|
||||||
|
XChatApplication.setIsSupportOaid(false, nres);
|
||||||
|
} else if (nres == ErrorCode.INIT_ERROR_RESULT_DELAY) {//1008614 获取接口是异步的,结果会在回调中返回,回调执行的回调可能在工作线程
|
||||||
|
//TODO 这种情况,还不清楚怎么解决呢。暂且先返false
|
||||||
|
XChatApplication.setIsSupportOaid(false, nres);
|
||||||
|
} else if (nres == ErrorCode.INIT_HELPER_CALL_ERROR) {//1008615 反射调用出错
|
||||||
|
XChatApplication.setIsSupportOaid(false, nres);
|
||||||
|
}
|
||||||
|
Log.d(getClass().getSimpleName(), "return value: " + String.valueOf(nres));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 通过反射调用,解决android 9以后的类加载升级,导至找不到so中的方法
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
private int CallFromReflect(Context cxt) {
|
||||||
|
return MdidSdkHelper.InitSdk(cxt, true, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 直接java调用,如果这样调用,在android 9以前没有题,在android 9以后会抛找不到so方法的异常
|
||||||
|
* 解决办法是和JLibrary.InitEntry(cxt),分开调用,比如在A类中调用JLibrary.InitEntry(cxt),在B类中调用MdidSdk的方法
|
||||||
|
* A和B不能存在直接和间接依赖关系,否则也会报错
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
private int DirectCall(Context cxt) {
|
||||||
|
MdidSdk sdk = new MdidSdk();
|
||||||
|
return sdk.InitSdk(cxt, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void OnSupport(boolean isSupport, IdSupplier _supplier) {
|
||||||
|
if (_supplier == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* String oaid=_supplier.getOaid();
|
||||||
|
String vaid=_supplier.getVAID();
|
||||||
|
String aaid=_supplier.getAAID();
|
||||||
|
String udid=_supplier.getUDID();
|
||||||
|
StringBuilder builder=new StringBuilder();
|
||||||
|
builder.append("support: ").append(isSupport?"true":"false").append("\n");
|
||||||
|
builder.append("UDID: ").append(udid).append("\n");
|
||||||
|
builder.append("OAID: ").append(oaid).append("\n");
|
||||||
|
builder.append("VAID: ").append(vaid).append("\n");
|
||||||
|
builder.append("AAID: ").append(aaid).append("\n");
|
||||||
|
String idstext=builder.toString();*/
|
||||||
|
|
||||||
|
XChatApplication.setIsSupportOaid(isSupport);
|
||||||
|
|
||||||
|
String oaid = _supplier.getOAID();
|
||||||
|
_supplier.shutDown(); //关闭接口
|
||||||
|
if (_listener != null) {
|
||||||
|
_listener.OnIdsAvalid(oaid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface AppIdsUpdater {
|
||||||
|
void OnIdsAvalid(@NonNull String ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
app/src/main/java/com/yizhuan/erban/utils/OAIDUtil.java
Normal file
36
app/src/main/java/com/yizhuan/erban/utils/OAIDUtil.java
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package com.yizhuan.erban.utils;
|
||||||
|
|
||||||
|
import com.yizhuan.erban.application.XChatApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: hgb
|
||||||
|
* @createTime: 2019/9/27
|
||||||
|
* @description:
|
||||||
|
* @changed by:
|
||||||
|
*/
|
||||||
|
public class OAIDUtil {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取唯一标识idfa
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 获取Oaid
|
||||||
|
*
|
||||||
|
* @return oaid或错误码
|
||||||
|
*/
|
||||||
|
public static String getOaid() {
|
||||||
|
String idfa;
|
||||||
|
if (XChatApplication.isSupportOaid()) {
|
||||||
|
idfa = XChatApplication.getOaid();
|
||||||
|
} else {
|
||||||
|
// idfa = "";
|
||||||
|
idfa = "获取失败,ErrorCode: " + XChatApplication.getErrorCode();
|
||||||
|
}
|
||||||
|
return idfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -112,8 +112,8 @@
|
|||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/iv_avatar_head_wear"
|
android:id="@+id/iv_avatar_head_wear"
|
||||||
android:layout_width="90dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="90dp"
|
android:layout_height="80dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/iv_user_head"
|
app:layout_constraintBottom_toBottomOf="@id/iv_user_head"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/iv_user_head"
|
app:layout_constraintLeft_toLeftOf="@id/iv_user_head"
|
||||||
app:layout_constraintRight_toRightOf="@id/iv_user_head"
|
app:layout_constraintRight_toRightOf="@id/iv_user_head"
|
||||||
|
@@ -23,6 +23,7 @@ import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
|
|||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseLoginAct;
|
import com.yizhuan.erban.base.BaseLoginAct;
|
||||||
import com.yizhuan.erban.ui.login.LoginPhoneActivity;
|
import com.yizhuan.erban.ui.login.LoginPhoneActivity;
|
||||||
|
import com.yizhuan.erban.utils.OAIDUtil;
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
||||||
@@ -50,9 +51,10 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
|||||||
* 基本权限管理
|
* 基本权限管理
|
||||||
*/
|
*/
|
||||||
private final String[] BASIC_PERMISSIONS = new String[]{
|
private final String[] BASIC_PERMISSIONS = new String[]{
|
||||||
// Manifest.permission.READ_PHONE_STATE,
|
Manifest.permission.READ_PHONE_STATE,
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||||
|
|
||||||
// Manifest.permission.CAMERA,
|
// Manifest.permission.CAMERA,
|
||||||
// Manifest.permission.RECORD_AUDIO,
|
// Manifest.permission.RECORD_AUDIO,
|
||||||
// Manifest.permission.ACCESS_COARSE_LOCATION,
|
// Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||||
@@ -61,7 +63,10 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
|||||||
|
|
||||||
private void permission() {
|
private void permission() {
|
||||||
checkPermission(() -> {
|
checkPermission(() -> {
|
||||||
InitialModel.get().reportBaiduAdv().subscribe();
|
String type = "bilibili";
|
||||||
|
String oaid = OAIDUtil.getOaid();
|
||||||
|
|
||||||
|
InitialModel.get().reportAdv(oaid).subscribe();
|
||||||
},
|
},
|
||||||
R.string.ask_again,
|
R.string.ask_again,
|
||||||
BASIC_PERMISSIONS);
|
BASIC_PERMISSIONS);
|
||||||
|
@@ -66,8 +66,8 @@ def loggerVersion = "2.2.0"
|
|||||||
def BaiduMtjVersion = "3.8.2.1"
|
def BaiduMtjVersion = "3.8.2.1"
|
||||||
def Lombok = "1.16.20"
|
def Lombok = "1.16.20"
|
||||||
def room_version = "1.1.1"
|
def room_version = "1.1.1"
|
||||||
def umeng_common = "2.1.8"
|
def umeng_common = "2.2.5"
|
||||||
def umeng_analytics = "8.1.4"
|
def umeng_analytics = "8.1.6"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
@@ -119,6 +119,7 @@ dependencies {
|
|||||||
api 'androidx.room:room-rxjava2:2.2.5'
|
api 'androidx.room:room-rxjava2:2.2.5'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
api project(':nim_uikit')
|
api project(':nim_uikit')
|
||||||
api project(':library')
|
api project(':library')
|
||||||
api project(':agora-ktv-kit-release')
|
api project(':agora-ktv-kit-release')
|
||||||
|
@@ -42,7 +42,8 @@ public interface IInitialModel extends IModel {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Single<ServiceResult> reportBaiduAdv();
|
|
||||||
|
Single<ServiceResult> reportAdv(String oaid);
|
||||||
|
|
||||||
int getTeenagerMode();
|
int getTeenagerMode();
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.SingleOnSubscribe;
|
import io.reactivex.SingleOnSubscribe;
|
||||||
import io.reactivex.SingleSource;
|
import io.reactivex.SingleSource;
|
||||||
@@ -439,14 +440,16 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Single<ServiceResult> reportBaiduAdv() {
|
public Single<ServiceResult> reportAdv(String oaid) {
|
||||||
String imei = TelephonyUtils.getImei(BasicConfig.INSTANCE.getAppContext());
|
String imei = TelephonyUtils.getImei(BasicConfig.INSTANCE.getAppContext());
|
||||||
String imeiMd5 = null;
|
String imeiMd5 = null;
|
||||||
if (!TextUtils.isEmpty(imei)) {
|
if (!TextUtils.isEmpty(imei)) {
|
||||||
imeiMd5 = MD5Utils.getMD5String(imei);
|
imeiMd5 = MD5Utils.getMD5String(imei);
|
||||||
}
|
}
|
||||||
return api.reportBaiduAdv(imeiMd5)
|
|
||||||
|
return api.reportAdv(imeiMd5,oaid)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
}
|
}
|
||||||
@@ -487,8 +490,8 @@ public class InitialModel extends BaseModel implements IInitialModel {
|
|||||||
* @param imeiMD5
|
* @param imeiMD5
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@POST("/observe/baidu/callback")
|
@POST("/observe/callback")
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
Single<ServiceResult> reportBaiduAdv(@Field("id") String imeiMD5);
|
Single<ServiceResult> reportAdv(@Field("imei") String imeiMD5,@Field("oaid") String oaidMD5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,5 +21,5 @@ with_jenkins=false
|
|||||||
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
|
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
|
||||||
ndk_abi_filters=arm
|
ndk_abi_filters=arm
|
||||||
|
|
||||||
version_name=1.0.3
|
version_name=1.0.4
|
||||||
version_code=103
|
version_code=104
|
@@ -10,6 +10,7 @@ import android.util.Log;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,8 +18,37 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class DeviceUuidFactory {
|
public class DeviceUuidFactory {
|
||||||
protected static final String PREFS_FILE = "device_id.xml";
|
private static final String PREFS_FILE = "device_id.xml";
|
||||||
protected static final String PREFS_DEVICE_ID = "device_id";
|
private static final String PREFS_DEVICE_ID = "device_id";
|
||||||
|
|
||||||
|
public static String getDeviceId(Context context) {
|
||||||
|
UUID uuid;
|
||||||
|
synchronized (DeviceUuidFactory.class) {
|
||||||
|
final SharedPreferences prefs = context.getSharedPreferences(PREFS_FILE, 0);
|
||||||
|
final String id = prefs.getString(PREFS_DEVICE_ID, null);
|
||||||
|
if (id != null) {
|
||||||
|
// Use the ids previously computed and stored in the prefs file
|
||||||
|
uuid = UUID.fromString(id);
|
||||||
|
} else {
|
||||||
|
final String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||||
|
// Use the Android ID unless it's broken, in which case fallback on deviceId,
|
||||||
|
// unless it's not available, then fallback on a random number which we store
|
||||||
|
// to a prefs file
|
||||||
|
if (!"9774d56d682e549c".equals(androidId)) {
|
||||||
|
uuid = UUID.nameUUIDFromBytes(androidId.getBytes(StandardCharsets.UTF_8));
|
||||||
|
} else {
|
||||||
|
uuid = UUID.randomUUID();
|
||||||
|
}
|
||||||
|
// Write the value out to the prefs file
|
||||||
|
prefs.edit().putString(PREFS_DEVICE_ID, uuid.toString()).apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (uuid == null) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return uuid.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a unique UUID for the current android device. As with all UUIDs, this unique ID is "very highly likely"
|
* Returns a unique UUID for the current android device. As with all UUIDs, this unique ID is "very highly likely"
|
||||||
@@ -43,38 +73,5 @@ 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.
|
||||||
*/
|
*/
|
||||||
public static String getDeviceId(Context context) {
|
|
||||||
UUID uuid = null;
|
|
||||||
synchronized (DeviceUuidFactory.class) {
|
|
||||||
final SharedPreferences prefs = context.getSharedPreferences(PREFS_FILE, 0);
|
|
||||||
final String id = prefs.getString(PREFS_DEVICE_ID, null);
|
|
||||||
if (id != null) {
|
|
||||||
// Use the ids previously computed and stored in the prefs file
|
|
||||||
uuid = UUID.fromString(id);
|
|
||||||
} else {
|
|
||||||
final String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
|
||||||
// Use the Android ID unless it's broken, in which case fallback on deviceId,
|
|
||||||
// unless it's not available, then fallback on a random number which we store
|
|
||||||
// to a prefs file
|
|
||||||
try {
|
|
||||||
if (!"9774d56d682e549c".equals(androidId)) {
|
|
||||||
uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8"));
|
|
||||||
} else {
|
|
||||||
final String deviceId = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
|
|
||||||
uuid = deviceId != null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : UUID.randomUUID();
|
|
||||||
}
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
// Write the value out to the prefs file
|
|
||||||
prefs.edit().putString(PREFS_DEVICE_ID, uuid.toString()).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (uuid == null) {
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
return uuid.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user