Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(android): device.isVirtual return false on simulator #134

Open
atefeh-akheraty opened this issue Oct 26, 2020 · 7 comments
Open

(android): device.isVirtual return false on simulator #134

atefeh-akheraty opened this issue Oct 26, 2020 · 7 comments

Comments

@atefeh-akheraty
Copy link

Bug Report

device.isVirtual return false on bluestack and nox player.

It is expected to return true.
but it returns false on both.

device version is 2.0.2

@timbru31
Copy link
Member

I thinks this one will be tricky, as NoxPlayer and BlueStacks try their best to hide that they are actually not a real Android device (I mean, that's their purpose...)

@timbru31 timbru31 changed the title device.isVirtual return false on simulator (android): device.isVirtual return false on simulator Oct 26, 2020
@atefeh-akheraty
Copy link
Author

thanks for reply.
I want to prevent users from screen record of my application.
On real device I do it by some plugin, but on simulator it not working. Also users that launche app on simulator can record their screen. So I need to detect device is running on real device or not.

@breautek
Copy link
Contributor

I'd fork the plugin and play with the isVirtual() method:

public boolean isVirtual() {
return android.os.Build.FINGERPRINT.contains("generic") ||
android.os.Build.PRODUCT.contains("sdk");
}

And try to determine if there are any hints that you're within a bluestacks simulator or a nox player emulator in android.os.Build.FINGERPRINT or android.os.Build.PRODUCT.

@timbru31
Copy link
Member

timbru31 commented Oct 26, 2020

A quick Google search gave me two results:

@breautek
Copy link
Contributor

breautek commented Oct 26, 2020

The SafetyNet API requires a self-managed backend service, so that would have to be an opt-in feature, probably best as an independent plugin. See the SafetyNet overview

But the answer posted at https://stackoverflow.com/a/49445230/1902598 could definitely be something incorporated in this plugin I think.

@atefeh-akheraty
Copy link
Author

I used this library: "https://github.com/framgia/android-emulator-detector". but it does not work correctly.
also does not work.
So I use this code:
if( Build.CPU_ABI.contains("x86") && arch.contains("i686")){ finish(); }

But the problem is on ASUS device that has intel cpu, it does not work.

@ForamRaiyani
Copy link

Did any one found any solution? I'm also getting device.isVirtual return false on nox emulator. Please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants