using UnityEngine; public class AndroidBatteryStatus : MonoBehaviour { private AndroidJavaObject androidPlugin; void Start() { // 创建Android插件实例 androidPlugin = new AndroidJavaObject("com.example.androidbatteryplugin.BatteryPlugin"); // 获取电池电量 int batteryLevel = androidPlugin.Call("GetBatteryLevel"); Debug.Log("Battery Level: " + batteryLevel + "%"); } }