java - Android 调用 Intent 权限

标签 java android android-intent

我正在尝试在我的应用程序中实现调用功能,我有以下代码:

Intent phoneCall = new Intent(Intent.ACTION_CALL);
phoneCall.setData(Uri.parse("123456"));
startActivity(phoneCall);

我在 list 文件中添加了所需的权限,但它仍然给出以下错误:

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.

你知道我该如何解决这个问题吗://

最佳答案

由于您的Target Sdk版本是23,因此您需要在运行时询问用户权限。尽管您仍然需要在 Manifest.xml 中包含权限。

这里有一些很棒的入门教程

Tutorial 1

Tutorial 2

关于java - Android 调用 Intent 权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35209138/

相关文章:

java - jar转exe问题

android - 减少推送角标(Badge)计数

java - startActivityForResult 返回错误的 Activity

android - 在 PendingIntent 中设置 FLAG_IMMUTABLE 时该参数为空

android - 在我的应用程序中从浏览器打开播放列表的 Intent 过滤器

java - 随机访问文件内存泄漏

java - 如何避免Springboot Camel Route每天在特定时间挂断信号而关闭

Java JApplet 图形双缓冲

android - 无法接收邮件中的附件

java - 安卓 OpenGL ES : How do you select a 2D object?