- If you have any questions/comments, please visit Pico Developer Answers and raise your question there.
AAR file is in /resource.
Note: Regarding AAR file creation and usage, please refer to the Guideline
This aar provides some methods to get the battery status.
com.picovr.libs.BatteryListener
public boolean isCharging()
public float getBatteryPercent()
public void GetBatteryPercent()
{
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject listener = new AndroidJavaObject("com.picovr.libs.BatteryListener", context, "BatteryListener", "BatteryCallBack");
float percent = listener.Call<float>("getBatteryPercent");
Debug.Log("====TAG==== GetBatteryPercent " + percent);
}
public void IsCharging()
{
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject listener = new AndroidJavaObject("com.picovr.libs.BatteryListener", context, "BatteryListener", "BatteryCallBack");
bool isCharging = listener.Call<bool>("isCharging");
Debug.Log("====TAG==== IsCharging " + isCharging);
}