Reliable way of detecting whether an Android app is running in 'BlueStacks'

how to detect if app is running on emulator
safetynet android example
bluestacks 4
safetynet attest
safety net android
safety net test
safetynet device attestation intune

I would like to ascertain at run-time inside an Android app whether it is running within the BlueStacks Android emulator. This is so I can modify the way the app runs when running inside BlueStacks.

BlueStacks does not support multi-touch so I want to implement an alternative to the standard pinch-to-zoom functionality my current app has.


If (appIsRunningInBlueStacks){
} else{

What is a reliable way of ascertaining the value of appIsRunningInBlueStacks?

EDIT Summary of answers to comments on question:

Ben, Taras, thanks for the suggestions. The Build.MODEL etc. values for BlueStacks are:

  • Model: "GT-I9100"

  • Manufacturer: "samsung"

  • Device: "GT-I9100"

  • Product: "GT-I9100"

This is the same model number as the Samsung Galaxy SII so it would not be ideal to use this for fear of treating all users with SIIs the same as those on BlueStacks.

CommonsWare, the app continues to run in BlueStacks even with the < uses-feature> for multitouch in the manifest. In fact (also answering iagreen's question)...


... returns true! This is to be expected I suppose as the emulator is convinced it is a Samsung Galaxy SII!

Therefore we are still without a way of reliably detecting whether an app is running on BlueStacks without also throwing all Samsung Galaxy SII users in the same bucket. Any other ideas?

You can check that the Bluestacks shared folder exist /sdcard/windows/BstSharedFolder

    Boolean onBlueStacks()
        File sharedFolder = new File(Environment
                + File.separatorChar
                + "windows"
                + File.separatorChar
                + "BstSharedFolder");

        if (sharedFolder.exists())
            return true;

        return false;

Checking if an Android application is running in the background , How do you see what processes are running on Android? The MapMyRun app was among the first 200 apps available for download from the iTunes store, with RunKeeper and Nike+ not far behind. The introduction of the running app was an exciting game-changer for many runners; it was an extremely cheap or even free way to use a device you already owned in order to track distance, pace and other training

After trying all the suggested solutions available online we found the Google's SafetyNet Attestation API is the only solution for detecting VMs like BlueStack(any version) and NoxPlayer.

Apps that care about content piracy (and other security issues) can filter their availability on the Google Play like Netflix filters devices on the PlayStore.

The new "device catalog" section of the console includes an option called "SafetyNet exclusion," which can be used to prevent "devices that fail integrity tests or those that are uncertified by Google," from downloading a specific app: among these would be rooted devices and those running custom ROMs.

But there is a catch user will still find the APK from cross-sharing or other distribution systems, so the client must implement SafetyNet Attestation API on the app level.

How does it work?

SafetyNet examines software and hardware information on the device where your app is installed to create a profile of that device. The service then attempts to find this same profile within a list of device models that have passed Android compatibility testing. The API also uses this software and hardware information to help you assess the basic integrity of the device, as well as the APK information of the calling app. This attestation helps you to determine whether or not the particular device has been tampered with or otherwise modified.

It's an (easy to implement) paid API from the Google which allows 10,000 free hits per day as of now :\

If anyone is interested in detecting VMs by them self, these are the good papers available suggesting heuristic approaches :

Evading Android Runtime Analysis via Sandbox Detection

Rage Against the Virtual Machine: Hindering Dynamic Analysis of Android Malware

How to check for and close background apps on Android., , your used and available RAM, and which apps are using it up. Reliable way of detecting whether an Android app is running in 'BlueStacks'. I would like to ascertain at run-time inside an Android app whether it is running within the BlueStacks Android emulator. This is so I can modify the way the app runs when running inside BlueStacks.

My version of BlueStacks is reporting my Build.Model as GT-N7100.

Using: android.opengl.GLES20.glGetString(android.opengl.GLES20.GL_RENDERER) I get Bluestacks.

How to stop Android apps running in the background, /2799097/how-can-i-detect-when-an-android-application-is-running-in-the-​emulator The problem is, if you don't want your app running on the simulator but only on a Fundamentally, you can't secure hardware you can't trust. If it The only way to prevent that for sure is to prevent the user from having  Depending on the running media, it will use different theme or UIs. The are several ways of detecting OS, device or screen resolutions, such as: navigator.userAgent.matc Skip to Content

It maybe too late but for the sake of others who have the same problem :

public boolean isRunningOnEmulator() {
    return 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")
        || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
        || "google_sdk".equals(Build.PRODUCT)
        || Build.PRODUCT.contains("vbox86p")
        || Build.DEVICE.contains("vbox86p")
        || Build.HARDWARE.contains("vbox86");

How can I ensure that an android app was installed on a physical , How to use? First, make sure your Android has the iw command. Without this, this project is of no use to you. Tested on Nougat (AEX &  The most reliable way to get this is to make a call to vkGetPhysicalDeviceSurfaceCapabilitiesKHR () at application startup and storing the returned extent - swapping the width and height based on the currentTransform that is also returned in order to ensure we are storing the identity screen resolution:

This Will be unique.

There is no bluetooth device in Bluestack.

So try to get The Bluetooth Address string which is always 'null' on Bluestack or Any emulator.Make sure you are adding Bluetooth permission on your project manifest.

BluetoothAdapter m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

 String m_bluetoothAdd = m_BluetoothAdapter.getAddress();

[Help] Reliable ways to detect if an app is running? foreground and , In summary, if we need to detect when our app is coming to the foreground or the app is entering to ON_STOP lifecycle process, then please run the Any suggestion doesn't hesitate to tell it using the comments. Best! So it's easy on iOS, since iPad1 and iPad2 are in iPhoneSettings.model (or in 3.5 SystemInfo.model, I assume). But how do you determine whether you are running on an Android tablet device? I suspect the only reliable way is to go by screen size. quitebuttery, Mar 11, 2012

Detecting when an Android app is in foreground or background, The next method although very reliable, cannot be used if you're going to put your app on onResume fires if the app is closed, but still running in the 11 ways to trick Detecting if an Android application is in the foreground or the background  WeatherPro brings reliable, worldwide weather forecasts and HD live maps with animated weather radar directly to your Android device. Perfect for running, fishing, camping, or riding a bike or motorcycle, WeatherPro was designed to empower life’s outdoor moments. Have the confidence to step outside no matter the weather with our free app with: • Clear dashboard with fast access to today

Android check if app is running in foreground, Detecting location · Requesting Permissions · Using the Speaker For example, if your app helps the user find their way while walking or driving, or if In response, the API updates your app periodically with the best available provided the app doesn't need to collect information even when it's running in the background. This app is designed specially to detect different cameras on the road, such as speed cameras, red light cameras, and so on. With the latest update, all the countries in the world are supported. The app is nicely designed, and you also have a night-mode feature.

Request location updates, If your app requires background location, such as when of the app, offers clear benefits to the user, and is done in a way that's Adopting these best practices doesn't guarantee Google Play approves your app's background location limits on devices that run Android 8.0 (API level 26) and higher. The best running apps can help you get more out of a run than just some exercise. Install a good running app on your phone, and it will use the device's built-in sensors to track your speed

  • Have you tried peeking through android.os.Build? (
  • Yes, try checking android.os.Build MODEL, MANUFACTURER, DEVICE, PRODUCT constants at runtime and checking their values, than simply check one of the parameter that works best and is unique at runtime.
  • Do you have the proper <uses-feature> elements to advertise that you require multitouch? Or is BlueStacks ignoring that?
  • @Taras: IIRC from a previous question, BlueStacks advertises itself as being a Galaxy Tab or some such, and so those Build values may not be as helpful as normal in this case.
  • Does BlueStacks correctly report FEATURE_TOUCHSCREEN_MULTITOUCH from the package manager? That seems the best way to go because then you gracefully degrade for all non-multitouch devices.
  • Unlike other typical and non-working answers, this one really works (however, bluetooth permission is needed)
  • listFiles return null