Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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

E.g.

If (appIsRunningInBlueStacks){
    mySurfaceView.enableMultiTouchAlternatives();
} else{
    mySurfaceView.enableMultiTouchFeatures();
}

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)...

packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);

... 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?

like image 735
Twice Circled Avatar asked Jan 03 '13 17:01

Twice Circled


People also ask

Can emulator be detected?

Android apps are typically not meant to be run on emulators by their users. Such behaviour can therefore be a sign of a possible attack or reverse engineering attempt. Malwarelytics for Android is able to detect that the app is running on an emulator and can be configured to terminate the app in such case.

How trustworthy is BlueStacks?

Is BlueStacks safe to use? In general, yes, BlueStacks is safe. What we mean is that the app itself is totally safe to download. BlueStacks is a legitimate company that's supported by and partnered with industry power players like AMD, Intel, and Samsung.

Can I run any Android app on BlueStacks?

BlueStacks can run multiple Android apps at once, and each app opens in a new tab within BlueStacks. It also offers a multi-instance mode that runs multiple instances of the same app, which may appeal to productivity buffs and gamers. BlueStacks also enables streaming Android gameplay live to Twitch.

Is there a better Android emulator than BlueStacks?

The best alternative is Android-x86, which is both free and Open Source. Other great apps like BlueStacks are Nox App Player, Genymotion, MEmu and Droid4X. BlueStacks alternatives are mainly Android Emulators but may also be Virtualization Tools or Operating Systems.


1 Answers

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

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

        if (sharedFolder.exists())
            {
            return true;
            }

        return false;
        }
like image 73
Regis St-Gelais Avatar answered Oct 02 '22 10:10

Regis St-Gelais