Determines if the app is running in the Android emulator. - Android App

Android examples for App:App Running

Description

Determines if the app is running in the Android emulator.

Demo Code


//package com.java2s;

import android.os.Build;

public class Main {
    /**/*  w  ww.  j av  a2  s .  c  om*/
     * Determines if the app is running in the Android emulator.
     *
     * http://stackoverflow.com/questions/2799097/ ->
     *   how-can-i-detect-when-an-android-application-is-running-in-the-emulator
     *
     * @return True if running in the emulator.
     */
    public static boolean isRunningInEmulator() {
        return Build.PRODUCT.equals("google_sdk")
                || Build.PRODUCT.equals("sdk")
                || Build.PRODUCT.equals("full_x86")
                || Build.FINGERPRINT.contains("generic");
    }
}

Related Tutorials