Java Code Examples for android.app.ActivityManager#isLowRamDevice()

The following examples show how to use android.app.ActivityManager#isLowRamDevice() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Util.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@TargetApi(VERSION_CODES.KITKAT)
public static boolean isLowMemory(Context context) {
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

  return (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activityManager.isLowRamDevice()) ||
         activityManager.getLargeMemoryClass() <= 64;
}
 
Example 2
Source File: LogSectionSystemInfo.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private static @NonNull String getMemoryClass(Context context) {
  ActivityManager activityManager = ServiceUtil.getActivityManager(context);
  String          lowMem          = "";

  if (activityManager.isLowRamDevice()) {
    lowMem = ", low-mem device";
  }

  return activityManager.getMemoryClass() + lowMem;
}
 
Example 3
Source File: MemorySizeCalculator.java    From giffun with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
private static boolean isLowMemoryDevice(ActivityManager activityManager) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        return activityManager.isLowRamDevice();
    } else {
        return Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
    }
}
 
Example 4
Source File: Utils.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
   public static boolean isLowRamDevice(Context context) {
   	if(Utils.hasKitKat()){
   		final ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
   		return am.isLowRamDevice();
   	}
   	return !hasMoreHeap();
}
 
Example 5
Source File: Utils.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
   public static boolean isLowRamDevice(Context context) {
   	if(Utils.hasKitKat()){
   		final ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
   		return am.isLowRamDevice();
   	}
   	return !hasMoreHeap();
}
 
Example 6
Source File: Utils.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
   public static boolean isLowRamDevice(Context context) {
   	if(Utils.hasKitKat()){
   		final ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
   		return am.isLowRamDevice();
   	}
   	return !hasMoreHeap();
}
 
Example 7
Source File: LogViewFragment.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(VERSION_CODES.KITKAT)
public static String getMemoryClass(Context context) {
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
  String          lowMem          = "";

  if (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activityManager.isLowRamDevice()) {
    lowMem = ", low-mem device";
  }
  return activityManager.getMemoryClass() + lowMem;
}
 
Example 8
Source File: Util.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(VERSION_CODES.KITKAT)
public static boolean isLowMemory(Context context) {
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

  return (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activityManager.isLowRamDevice()) ||
         activityManager.getLargeMemoryClass() <= 64;
}
 
Example 9
Source File: Util.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(VERSION_CODES.KITKAT)
public static boolean isLowMemory(Context context) {
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

  return (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activityManager.isLowRamDevice()) ||
         activityManager.getMemoryClass() <= 64;
}
 
Example 10
Source File: MainApplication.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
public boolean isLowRam() {
	if (C.API_KITKAT) {
		ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
		return activityManager != null && activityManager.isLowRamDevice();
	} else {
		return Runtime.getRuntime().maxMemory() <= 64 * 1024 * 1024;
	}
}
 
Example 11
Source File: SubmitLogFragment.java    From libpastelog with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(VERSION_CODES.KITKAT)
public static String getMemoryClass(Context context) {
  ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
  String          lowMem          = "";

  if (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activityManager.isLowRamDevice()) {
    lowMem = ", low-mem device";
  }
  return activityManager.getMemoryClass() + lowMem;
}
 
Example 12
Source File: Util.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isLowMemory(Context context) {
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

    return (activityManager.isLowRamDevice()) || activityManager.getLargeMemoryClass() <= 64;
}
 
Example 13
Source File: RoomDatabase.java    From FairEmail with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isLowRamDevice(@NonNull ActivityManager activityManager) {
    if (Build.VERSION.SDK_INT >= 19) {
        return activityManager.isLowRamDevice();
    }
    return false;
}
 
Example 14
Source File: ActivityManagerCompatKitKat.java    From adt-leanback-support with Apache License 2.0 4 votes vote down vote up
public static boolean isLowRamDevice(ActivityManager am) {
    return am.isLowRamDevice();
}
 
Example 15
Source File: MemorySizeCalculator.java    From sketch with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
private static boolean isLowMemoryDevice(@Nullable ActivityManager activityManager) {
    final int sdkInt = Build.VERSION.SDK_INT;
    return activityManager == null || sdkInt >= Build.VERSION_CODES.KITKAT && activityManager.isLowRamDevice();
}