is Emulator - Android Android OS

Android examples for Android OS:OS Build

Description

is Emulator

Demo Code


//package com.java2s;
import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;

public class Main {
    public static boolean isEmulator(Context context) {
        TelephonyManager telephonyManager = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        String imei = telephonyManager.getDeviceId();
        if (imei != null && imei.equals("000000000000000"))
            return true;
        return Build.MODEL.equals("sdk")
                || Build.MODEL.equals("google_sdk");
    }//  w  w  w  . j a  va2 s.c  o  m
}

Related Tutorials