Skip to content

Instantly share code, notes, and snippets.

@DelphiWorlds
Created April 24, 2020 22:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DelphiWorlds/15f6bd1404fcc67ba72edc691ca34912 to your computer and use it in GitHub Desktop.
Save DelphiWorlds/15f6bd1404fcc67ba72edc691ca34912 to your computer and use it in GitHub Desktop.
uses
Androidapi.JNI.App, Androidapi.Helpers, Androidapi.JNI.GraphicsContentViewText;
// Available memory in MB
function GetMemory: Int64;
var
LMemoryInfo: JActivityManager_MemoryInfo;
LActivityManager: JActivityManager;
begin
LActivityManager := TJActivityManager.Wrap(JObjectToID(TAndroidHelper.Context.getSystemService(TJActivity.JavaClass.ACTIVITY_SERVICE)));
LMemoryInfo := TJActivityManager_MemoryInfo.Create;
LActivityManager.getMemoryInfo(LMemoryInfo);
Result := Round(LMemoryInfo.availMem / $100000);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment