public static UPTraceObject getInstance() { if (instance == null) { GameObject polyCallback = new GameObject(Unity_Callback_Class_Name); polyCallback.hideFlags = HideFlags.HideAndDontSave; DontDestroyOnLoad(polyCallback); instance = polyCallback.AddComponent <UPTraceObject> (); } return(instance); }
// "do nothing"; #endif public UPTraceCall() { UPTraceObject.getInstance(); #if UNITY_IOS && !UNITY_EDITOR Debug.Log("===> UPTraceCall instanced."); #elif UNITY_ANDROID && !UNITY_EDITOR if (jc == null) { Debug.Log("===> UPTraceCall instanced."); jc = new AndroidJavaClass(JavaClassName); } #endif }
public void getConversionData(string afConversionData, Action <string> success, Action <string> fail) { // 设置callback回调 UPTraceObject.getInstance().setGetConversionDataCallback(success, fail); // 调用原生的方法 #if UNITY_IOS && !UNITY_EDITOR getConversionDataForIos(UPTraceObject.Unity_Callback_Class_Name, UPTraceObject.Unity_Callback_Function_Name, afConversionData); #elif UNITY_ANDROID && !UNITY_EDITOR if (jc != null) { jc.CallStatic(JavaClassStaticMethod_GetConversionData, afConversionData); } #endif }
public void getUserAdLayer(Action <string> success, Action <string> fail) { Debug.Log("getUserAdLayer in tracecall"); // 设置callback回调 UPTraceObject.getInstance().setUserAdLayerCallback(success, fail); // 调用原生的方法 #if UNITY_IOS && !UNITY_EDITOR getAdUserLayerForIos(UPTraceObject.Unity_Callback_Class_Name, UPTraceObject.Unity_Callback_Function_Name); #elif UNITY_ANDROID && !UNITY_EDITOR if (jc != null) { jc.CallStatic(JavaClassStaticMethod_GetUserAdLayer); } #endif }