![](/img/trans.png)
[英]Can you download apps from Google play onto an Android Studio AVD (Android Virtual Device)?
[英]Android users without cameras on their devices can't download my apps from Google Play - Why?
我的清單中有以下權限:
<uses-permission android:name="android.permission.CAMERA" />
這是因為他們設備上沒有攝像頭的用戶無法從Google Play下載我的應用程序嗎?
有沒有辦法讓這個權限可選? 含義......我需要使用你的相機,但是如果你沒有相機,你仍然可以使用我的應用程序。
根據Imply Feature Requirements頁面的權限, CAMERA
暗示android.hardware.camera
。 您可以通過包含使其成為可選項
<uses-feature android:name="android.hardware.camera" android:required="false" />
我找到了一篇很好的文章說明了什么是已接受的答案,但也添加了如何處理用戶嘗試打開相機相關功能但沒有相機的情況。
文章中的簡單代碼:
// Check that the device will let you use the camera
PackageManager pm = getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
// Do camera stuff...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.