Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cod #49

Open
Tomes111 opened this issue May 16, 2020 · 0 comments
Open

Cod #49

Tomes111 opened this issue May 16, 2020 · 0 comments

Comments

@Tomes111
Copy link

@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;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant