sl4a icon indicating copy to clipboard operation
sl4a copied to clipboard

Cod

Open Tomes111 opened this issue 5 years ago • 0 comments

@Rpc(description = "Get Memory Statistics By Type") public float getMemoryStat(@RpcParameter(name = "type") String type) throws InterruptedException { ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); activityManager.getMemoryInfo(mi);

    long availableMegs = mi.availMem / 1048576L;  // returns percentages

    long percentAvail = mi.availMem / mi.totalMem; // returns percentages

    if (type == "avail") {
        return mi.availMem;
    } else {
        return mi.totalMem;
    }

Tomes111 avatar May 16 '20 02:05 Tomes111