Просмотр исходного кода

[FC]:提交部分Oaid Android端功能

fengcong 5 лет назад
Родитель
Сommit
d0b4097e88

+ 12 - 0
assets/script/before.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "8a05eef2-bb3d-420c-9b10-315b47fd78c1",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

BIN
build/jsb-link/frameworks/runtime-src/proj.android-studio/.idea/caches/build_file_checksums.ser


+ 1 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/.idea/modules/app/mk_framework.iml

@@ -293,6 +293,7 @@
     <orderEntry type="library" name="Gradle: ./app/libs/topon/libs/open_ad_sdk_3.5.0.8.aar" level="project" />
     <orderEntry type="library" name="Gradle: ./app/libs/topon/libs/tramini_sdk.aar" level="project" />
     <orderEntry type="library" name="Gradle: ./app/libs/topon/libs/windAd-2.25.2.aar" level="project" />
+    <orderEntry type="library" name="Gradle: ./app/libs/oaid/oaid_sdk_1.0.25.aar" level="project" />
     <orderEntry type="library" name="Gradle: com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.7.4@aar" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:design:28.0.0@aar" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:28.0.0@aar" level="project" />

+ 2 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build.gradle

@@ -165,4 +165,6 @@ dependencies {
     api 'com.android.support:design:28.0.0'//从v5.6.2版本开始,如果有聚合快手的v2.7.2及以上版本需要添加此依赖
     implementation 'com.android.support:multidex:1.0.3' //应对接入后发布报single dex相关错误,defaultConfig中需同步设置multiDexEnabled true
 
+    //OaidSDK
+    api fileTree(include: ['*.jar','*.aar'], dir: 'libs/oaid')
 }

BIN
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/libs/oaid/oaid_sdk_1.0.25.aar


+ 74 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/thirdSdk/oaid/OaidHelper.java

@@ -0,0 +1,74 @@
+package org.cocos2dx.javascript.thirdSdk.oaid;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.util.Log;
+
+import com.bun.miitmdid.core.ErrorCode;
+import com.bun.miitmdid.core.MdidSdkHelper;
+import com.bun.miitmdid.interfaces.IIdentifierListener;
+import com.bun.miitmdid.interfaces.IdSupplier;
+
+public class OaidHelper implements IIdentifierListener {
+
+    private AppIdsUpdater _listener;
+    public OaidHelper(AppIdsUpdater callback){
+        _listener=callback;
+    }
+
+    public void getDeviceIds(Context cxt){
+        long timeb=System.currentTimeMillis();
+        // 方法调用
+        int nres = CallFromReflect(cxt);
+
+        long timee=System.currentTimeMillis();
+        long offset=timee-timeb;
+        if(nres == ErrorCode.INIT_ERROR_DEVICE_NOSUPPORT){//不支持的设备
+
+        }else if( nres == ErrorCode.INIT_ERROR_LOAD_CONFIGFILE){//加载配置文件出错
+
+        }else if(nres == ErrorCode.INIT_ERROR_MANUFACTURER_NOSUPPORT){//不支持的设备厂商
+
+        }else if(nres == ErrorCode.INIT_ERROR_RESULT_DELAY){//获取接口是异步的,结果会在回调中返回,回调执行的回调可能在工作线程
+
+        }else if(nres == ErrorCode.INIT_HELPER_CALL_ERROR){//反射调用出错
+
+        }
+        Log.d(getClass().getSimpleName(),"return value: "+String.valueOf(nres));
+    }
+
+    /*
+     * 方法调用
+     *
+     */
+    private int CallFromReflect(Context cxt){
+        return MdidSdkHelper.InitSdk(cxt,true,this);
+    }
+
+    /*
+     * 获取相应id
+     *
+     */
+    @Override
+    public void OnSupport(boolean isSupport, IdSupplier _supplier) {
+        if(_supplier==null) {
+            return;
+        }
+        String oaid=_supplier.getOAID();
+        String vaid=_supplier.getVAID();
+        String aaid=_supplier.getAAID();
+        StringBuilder builder=new StringBuilder();
+        builder.append("support: ").append(isSupport?"true":"false").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();
+        if(_listener!=null){
+            _listener.OnIdsAvalid(idstext);
+        }
+    }
+
+    public interface AppIdsUpdater{
+        void OnIdsAvalid(@NonNull String ids);
+    }
+}

+ 4 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/util/DeviceUtil.java

@@ -0,0 +1,4 @@
+package org.cocos2dx.javascript.util;
+
+public class DeviceUtil {
+}