简体   繁体   English

如何知道我的应用程序是否在Bluestacks上运行?

[英]How to know whether my App is running on Bluestacks?

I'm working on a special version of my App which should run in Bluestacks . 我正在研究应用程序的特殊版本,它应该在Bluestacks中运行。 It's a windows/mac application which allows to run Android apps on the computer. 它是一个Windows / mac应用程序,允许在计算机上运行Android应用程序。

I would like to implement special behaviour when the app runs in Bluestacks. 当应用程序在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. 但为此我需要知道该应用程序是否在Bluestacks设备上运行。 I checked the device model ( Build.MODEL ) and manufacturer ( Build.MANUFACTURER ), but I get that the device is a Samsung GT i900. 我检查了设备型号( Build.MODEL )和制造商( Build.MANUFACTURER ),但我得知该设备是Samsung GT i900。

Does someone know an unambiguous way to know whether an app is running on Bluestacks? 有人知道一个明确的方法来了解应用程序是否在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. 我知道这是一个非常本地化的问题,但如果我得到一些关于在哪里查看或尝试什么的想法,那就没关系了。

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;
}

Finally I decided to build a new app for Bluestacks using an Android library. 最后,我决定使用Android库为Bluestacks构建一个新的应用程序。 This allows me to add special behaviour for the bluestacks app. 这允许我为bluestacks应用程序添加特殊行为。

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. 我尝试使用Build类获取所有信息,但它返回的功能与Samsung Galaxy GT i9000设备相同,因此无法知道设备是否正在bluestack中运行。

尝试以下代码:
File test = new File("/data/Bluestacks.prop"); boolean isRunningInBluestacks = test.exists();

This Will be unique. 这将是独一无二的。

There is no bluetooth device in Bluestack. 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. 因此,尝试在Bluestack或Any模拟器上获取始终为“null”的蓝牙地址字符串。确保在项目清单上添加蓝牙权限。

BluetoothAdapter m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); 
String m_bluetoothAdd = m_BluetoothAdapter.getAddress();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何阻止我的应用在 Bluestacks 模拟器上运行? - How to block my app from running on Bluestacks emulator? 我如何知道我的Android应用程序是否在后台运行? - How do I know whether or not my Android app is running in background? 检测 Android 应用程序是否在“BlueStacks”中运行的可靠方法 - Reliable way of detecting whether an Android app is running in 'BlueStacks' 如何知道服务是否正在运行 - how to know whether service is running or not 如何知道我的android应用正在接收器中运行? - How to know my android app is running in the receiver? 我怎么知道JobScheduler是否正在运行? - How can I know whether a JobScheduler is running? 如何知道 MediaRecorder 是否正在运行 state? - How to know whether a MediaRecorder is in running state or not? 如何知道我的Android BroadcastReceiver是否已注册 - How to know whether my Android BroadcastReceiver is registered or not 我如何知道我的应用程序是否正在使用 Robolectric 运行? - How do I know if my app is running with Robolectric? 如何检测我的应用程序是否在Bluestacks / Nox或其他模拟器下运行? - How can I detect if my app is working under Bluestacks/Nox or other emulator?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM