I want to make a ram booster app. For two months long, i am trying to clean unused data from the ram of android device programmatically. Though through searching the internet, I have found codes for deleting the unused data of itself, I cannot find any code directly for cleaning the ram unused data. I also have used some codes from the internet,but did not get any result. I want to get suggestion how can i do it. Here is a code i have tried. Using this code, i have seen that after running the app, it cleans some memory from the app, but after a few seconds the ram memory again fills up .
List<ApplicationInfo> packages;
PackageManager pm;
pm = getPackageManager();
packages = pm.getInstalledApplications(0);
ActivityManager mActivityManager = (ActivityManager)getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
for (ApplicationInfo packageInfo : packages) {
if((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM)==1)continue;
if(packageInfo.packageName.equals("mypackage")) continue;
mActivityManager.killBackgroundProcesses(packageInfo.packageName);
// mActivityManager.restartPackage(packageInfo.packageName);
}
If you make a RAm booster app it would pay to first investigate how android works. Android RAM is supposed to be filled - or at least a high part. That makes it so snappy to switch between apps.
Android will kill old processes itself (freeing up RAM) automatically when it needs to. If you're seeing apps come back after a couple of minutes, it's because the framework is trying to repopulate the RAM.
Cleaning RAM on windows is good: if it's full your pc.gets slower Cleaning RAM on Android is bad: if it's empty it needs to reinitialise all processes when started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With