Android 尝试访问摄像头时,阻止访问摄像头的企业 MDM 设备上的应用程序崩溃

Android App crashing on Enterprise MDM devices which are blocking access to camera, when trying to access it

应用程序在禁止摄像头访问的 Zebra MDM 设备上崩溃,因此在尝试访问摄像头时应用程序崩溃。有什么方法可以事先检查相机是否可用。

在与 Zebra 支持人员交谈后,他们指出了以下 SO link。 How to know if application is disabled in Android ICS

ApplicationInfo ai = getActivity().getPackageManager().getApplicationInfo("your_package",0);

布尔 appStatus = ai.enabled;