How to restrict an APK not to get installed in Android Emulator/Simulator but in real device?(如何限制 APK 不安装在 Android Emulator/Simulator 中,而是安装在真实设备中?)
问题描述
希望您知道,可以借助 Astro 文件管理器等应用程序将安装在 android 设备中的应用程序备份并存储为可安装文件(作为 APK 文件).同样的 apk 也可以安装在 android 模拟器中.因此,其他人有机会轻松挖掘已安装应用程序的文件,如 DB、共享首选项等.
Hope you know that an application which is installed in an android device can be backed up and stored as an installable file(as an APK file) with the help of apps like Astro file manager. The same apk can be installed in the android simulator as well. So there is a chance that other can easily dig into the installed app's files like DB, shared preference, etc..
有没有办法只允许在真机上安装而不是在模拟器上安装???
Is there any way to permit installing only in real device and not in simulators???
我知道,如果它是 ROOTED 设备,我们可以像在模拟器中一样访问应用程序的数据.即使我想知道我们是否可以限制在模拟器中安装 apk.
I know that if it is ROOTED device, we can access the app's data same like in the simulator. Even though i would like to know whether we can restrict installing apk in simulators.
提前致谢
推荐答案
使用这个函数:
public static boolean isEmulator() {
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);
}
为此:
if (isEmulator()) {
// emulator
} else {
//not emulator
}
我的建议:
从 github 尝试 this.
try this from github.
容易检测的安卓模拟器
- 在 Device Farm 中的真实设备上检查 (https://aws.amazon.com/device-farm/)
- 蓝叠
- Genymotion
- 安卓模拟器
- 安迪 46.2.207.0
- MEmu 玩
- Nox 应用播放器
- Koplayer
- .....
如何使用示例:
EmulatorDetector.with(this)
.setCheckTelephony(true)
.addPackageName("com.bluestacks")
.setDebug(true)
.detect(new EmulatorDetector.OnEmulatorDetectorListener() {
@Override
public void onResult(boolean isEmulator) {
}
});
这篇关于如何限制 APK 不安装在 Android Emulator/Simulator 中,而是安装在真实设备中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何限制 APK 不安装在 Android Emulator/Simulator 中,而是安装在真实设备中?


- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01