Files
2025-01-25 04:38:09 +08:00

38 lines
957 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Core.Base
{
#if !UNITY_IPHONE
public class AndroidMemoryInfo:IMemoryInfo
{
public const string CN_PLUGIN_MEMORY_CLASS_NAME = "com.thousandto.plugin.utils.MemoryUtils";
private IAndroidPlayer _player;
public AndroidMemoryInfo()
{
_player = AndroidPlayer.ShareInstance;
}
public long GetFreeMemory()
{
return _player.CallFuncStatic<long>(CN_PLUGIN_MEMORY_CLASS_NAME, "getSystemFreeMemory",_player.GetActivity()) / 1024;
}
public double GetSumMemory()
{
return UnityEngine.SystemInfo.systemMemorySize;
}
public double GetAppUsedMemory()
{
return (float)_player.CallFuncStatic<int>(CN_PLUGIN_MEMORY_CLASS_NAME, "getUsedMemoryBySelf", _player.GetActivity()) / 1024f;
}
}
#endif
}