0
我想實現我的應用程序的調用函數我有以下代碼:Android的呼叫意圖權限
Intent phoneCall = new Intent(Intent.ACTION_CALL);
phoneCall.setData(Uri.parse("123456"));
startActivity(phoneCall);
我在清單文件所需的權限添加,但它仍然給我下面的錯誤:
Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException` less... (Ctrl+F1)
This inspection looks at Android API calls and ensures that the correct type of resource is passed to an int-parameter expecting resources of a given type; it checks that APIs which expect an RGB color integer are passed actual colors rather than color resources; it checks that APIs which require a certain permission have the permission declared in the manifest; it checks that parameters expected to fall within a given range actually do; it checks that results of certain method calls are looked at by the caller, and so on.
你知道我怎麼能解決這個問題://
從API 23起,需要在運行時檢查權限,因爲它們可以被撤銷用戶:https://developer.android.com/training/permissions/requesting.html –
它實際上寫在錯誤上。'代碼應該明確地檢查是否有權限(帶有「checkPermission」)或者顯式處理潛在的「SecurityException」 – Enrichman
錯誤消息告訴你如何解決這個問題。閱讀。 –