is Running On Emulator - Android android.os

Android examples for android.os:Build

Description

is Running On Emulator

Demo Code


//package com.java2s;
import android.os.Build;

public class Main {
    public static boolean isRunningOnEmulator() {
        boolean result = //
        Build.FINGERPRINT.startsWith("generic")//
                || Build.FINGERPRINT.startsWith("unknown")//
                || Build.MODEL.contains("google_sdk")//
                || Build.MODEL.contains("Emulator")//
                || Build.MODEL.contains("Android SDK built for x86")
                || Build.MANUFACTURER.contains("Genymotion");
        if (result)
            return true;
        result |= Build.BRAND.startsWith("generic")
                && Build.DEVICE.startsWith("generic");
        if (result)
            return true;
        result |= "google_sdk".equals(Build.PRODUCT);
        return result;
    }//from  w ww  .jav  a  2 s  .  c o m
}

Related Tutorials