android.support.v4.app.ActivityManagerCompat Java Examples

The following examples show how to use android.support.v4.app.ActivityManagerCompat. 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: ContextUtils.java    From memetastic with GNU General Public License v3.0 5 votes vote down vote up
public boolean isDeviceGoodHardware() {
    try {
        ActivityManager activityManager = (ActivityManager) _context.getSystemService(Context.ACTIVITY_SERVICE);
        return !ActivityManagerCompat.isLowRamDevice(activityManager) &&
                Runtime.getRuntime().availableProcessors() >= 4 &&
                activityManager.getMemoryClass() >= 128;
    } catch (Exception ignored) {
        return true;
    }
}
 
Example #2
Source File: ContextUtils.java    From openlauncher with Apache License 2.0 5 votes vote down vote up
public boolean isDeviceGoodHardware() {
    try {
        ActivityManager activityManager = (ActivityManager) _context.getSystemService(Context.ACTIVITY_SERVICE);
        return !ActivityManagerCompat.isLowRamDevice(activityManager) &&
                Runtime.getRuntime().availableProcessors() >= 4 &&
                activityManager.getMemoryClass() >= 128;
    } catch (Exception ignored) {
        return true;
    }
}
 
Example #3
Source File: GlideConfiguration.java    From RxPalette with Apache License 2.0 5 votes vote down vote up
@Override
public void applyOptions(Context context, GlideBuilder builder) {
    // Prefer RGB 535 on lower end devices
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    builder.setDecodeFormat(ActivityManagerCompat.isLowRamDevice(am)
            ? DecodeFormat.PREFER_RGB_565
            : DecodeFormat.PREFER_ARGB_8888);
}
 
Example #4
Source File: MediaRouter.java    From cwac-mediarouter with Apache License 2.0 5 votes vote down vote up
GlobalMediaRouter(Context applicationContext) {
    mApplicationContext = applicationContext;
    mDisplayManager = DisplayManagerCompat.getInstance(applicationContext);
    mLowRam = ActivityManagerCompat.isLowRamDevice(
            (ActivityManager)applicationContext.getSystemService(
                    Context.ACTIVITY_SERVICE));

    // Add the system media route provider for interoperating with
    // the framework media router.  This one is special and receives
    // synchronization messages from the media router.
    mSystemProvider = SystemMediaRouteProvider.obtain(applicationContext, this);
    addProvider(mSystemProvider);
}