5

I'm working on a special version of my App which should run in Bluestacks. It's a windows/mac application which allows to run Android apps on the computer.

I would like to implement special behaviour when the app runs in Bluestacks. Nothing complicated, maybe showing a dialog or disabling some buttons.

But for that purpose I need to know whether the app is running on a Bluestacks device. I checked the device model (Build.MODEL) and manufacturer (Build.MANUFACTURER), but I get that the device is a Samsung GT i900.

Does someone know an unambiguous way to know whether an app is running on Bluestacks?

I know it´s rather a quite localized question, but it would be fine if I get some ideas about where to look at, or what to try.

Esparver
  • 1,515
  • 1
  • 15
  • 28

4 Answers4

4

Try this:

/**
* Returns true if device is Android port to x86
 */
public static boolean isx86Port()
{
    String kernelVersion = System.getProperty("os.version");
    if(kernelVersion != null && kernelVersion.contains("x86")) // for BlueStacks returns "2.6.38-android-x86+"
        return true;
    return false;
}
MADev
  • 59
  • 1
  • 2
  • BlueStacks (reports version "2.0.0 (12)" up-to-date as of Oct. 2018) on my mac (macOS 10.13.6) reports `os.version` of `4.0.9-android`. – neuralmer Oct 17 '18 at 17:59
1

try below code:
File test = new File("/data/Bluestacks.prop"); boolean isRunningInBluestacks = test.exists();

xiaoweiz
  • 162
  • 3
  • 10
0

Finally I decided to build a new app for Bluestacks using an Android library. This allows me to add special behaviour for the bluestacks app.

I tried to get all the info using the Build class, but it returns the same as a Samsung Galaxy GT i9000 device, so it's impossible to know that the device is running in bluestacks.

Esparver
  • 1,515
  • 1
  • 15
  • 28
0

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();
Pang
  • 9,564
  • 146
  • 81
  • 122
user3527444
  • 269
  • 1
  • 4
  • 7