SDK测试

main
Yuntao Hu 2025-11-18 19:41:00 +08:00
parent 67d513434a
commit 05d3c4efa8
5 changed files with 23 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using UnityEngine;
@ -101,5 +102,22 @@ public class DeviceIdHandle
#else
Debug.Log("GetDeviceID: Initialized (editor or non-Android). Android call skipped.");
#endif
#if SDK_BYTEDANCE
try
{
AndroidJavaClass bridgeClass = new AndroidJavaClass("com.bytedance.convertunitybridge.ConvertUnityBridge");
var up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
var activity = up.GetStatic<AndroidJavaObject>("currentActivity");
if (activity == null) return;
bridgeClass.CallStatic("init", activity, true);
}
catch (Exception e)
{
Debug.LogError("BYTEDANCE SDK init Error! " + e);
}
#endif
}
}

View File

@ -45,3 +45,4 @@ TalkingData:
Packages:
- CrashSight@latest
- DeviceHelper@0.0.1
- ByteDanceAds@2.0.0

View File

@ -0,0 +1,2 @@
Define_list:
- SDK_BYTEDANCE