|
@@ -30,9 +30,10 @@ import cn.yyxx.commsdk.core.utils.ManifestUtils;
|
|
|
import cn.yyxx.commsdk.core.utils.ParamsUtils;
|
|
|
import cn.yyxx.commsdk.core.utils.ResourceUtil;
|
|
|
import cn.yyxx.commsdk.core.utils.SharedPreferencesUtils;
|
|
|
+import cn.yyxx.commsdk.impl.channel.msa.IMsaDeviceIdsCallback;
|
|
|
+import cn.yyxx.commsdk.impl.channel.msa.MsaDeviceIdsHandler;
|
|
|
import cn.yyxx.support.JsonUtils;
|
|
|
-import cn.yyxx.support.msa.IMsaDeviceIdsCallback;
|
|
|
-import cn.yyxx.support.msa.MsaDeviceIdsHandler;
|
|
|
+
|
|
|
import cn.yyxx.support.permission.IPermissionCallback;
|
|
|
import cn.yyxx.support.permission.Permission;
|
|
|
import cn.yyxx.support.permission.PermissionKit;
|
|
@@ -140,19 +141,20 @@ public class CommonOperationManager {
|
|
|
public void initMsaDeviceIds(Application application,Context context){
|
|
|
MsaDeviceIdsHandler.initMsaDeviceIds(application, new IMsaDeviceIdsCallback() {
|
|
|
@Override
|
|
|
- public void onIdsRead(int code, String msg, Map<String, String> map) {
|
|
|
- Logger.d("msa sdk attach , code : " + code + " , msg : " + msg);
|
|
|
- hasIdsRead = true;
|
|
|
+ public void onIdsRead(int code, String msg, Map<String, String> ids) {
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@SuppressLint("MissingPermission")
|
|
|
- public String getIfa(Context context){
|
|
|
+ public JSONObject getIfa(Context context){
|
|
|
String ifa = "";
|
|
|
+ String ifa_type= "";
|
|
|
+
|
|
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P){
|
|
|
|
|
|
ifa = MsaDeviceIdsHandler.oaid;
|
|
|
-
|
|
|
+ ifa_type = "2";
|
|
|
}else{
|
|
|
if (PermissionKit.isGranted(context,Permission.READ_PHONE_STATE)){
|
|
|
@SuppressLint("ServiceCast") TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELECOM_SERVICE);
|
|
@@ -162,16 +164,27 @@ public class CommonOperationManager {
|
|
|
ifa = telephonyManager.getDeviceId();
|
|
|
}
|
|
|
}
|
|
|
+ ifa_type = "1";
|
|
|
}
|
|
|
|
|
|
if (ifa.isEmpty()){
|
|
|
ifa = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);
|
|
|
+ ifa_type = "3";
|
|
|
if (ifa.isEmpty()){
|
|
|
ifa = userSimulateImei(context);
|
|
|
+ ifa_type = "0";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return ifa;
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ try {
|
|
|
+ json.put("ifa",ifa);
|
|
|
+ json.put("ifa_type",ifa_type);
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return json;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -298,6 +311,7 @@ public class CommonOperationManager {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
public enum Result{
|
|
|
/**
|
|
|
* 授权
|