suresh
suresh

Reputation: 87

callIntenet is not working, i have no idea how to fix this.

error message

the error msg says: 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.

code: Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + phone)); startActivity(callIntent); image:

Upvotes: 0

Views: 550

Answers (2)

jomartigcal
jomartigcal

Reputation: 813

Starting on Marshmallow, you need to check for permissions first. ACTION_CALL requires a CALL_PHONE permission. Instead of ACTION_CALL, maybe you can use ACTION_DIAL for it does not need any permission. Itt will not call directly the number you specified but open the user's default dialer app with the number specified.

Upvotes: 0

PrakashSharma
PrakashSharma

Reputation: 386

From API 23, It is necessary to check permission even after declared in manifest.

int permissionCheck = ContextCompat.checkSelfPermission(context, Manifest.permission.INTERNET);

Refer http://developer.android.com/training/permissions/requesting.html

Upvotes: 0

Related Questions