1. Introduction

 

You might have notice a error when you try to make a call, read a message, access your contacts, camera, and few more services from your app in Android Marshmallow 6.0 (API level 23).Want to know the reason behind it then this tutorial is for you.

Android Marshmallow has got some advanced security features so as to make sure that user know what type of permissions a app require while he/she try to use them i.e., when ever you try to open a app it will ask you few permission depending upon the app functionality.

 

androidpermissions

 

 

By now you might got  an idea what would it look like so you need to few more things as all permissions are not asked in this manner only few are listed out and which are termed to be dangerous permissions and which are to be notified to user and after getting permission will move further.

 

Want to know more information regarding this topic

Requesting Permissions at Run Time

 

 

I will show you how to make a call using a permission window in android marshmallow in this tutorial.

 

2. Creating MainActivity.java :

 

Here in this tutorial we need not required to design a screen as we are not performing any user clickable functionality as the app starts up it will ask a permission for making a call through the device.

 

Declare a method call() in which call functionality is implemented.

 

 

And in oncreate we will check whether permission is granted or not if not granted we need to ask for permission.

 

 

And permission is not granted the we need to request for permission as

 

 

Full Code

 

 

And when you run this code you will be prompted to accept a permission regarding call and will make a call if you permitted.

 

3.  AndroidManifest.xml

 

Add call permission in manifest file

 

 



Share article on

Show Buttons
Hide Buttons

June 25, 2017

Attention Required! | Cloudflare

One more step

Please complete the security check to access push.wppush.co

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this in the future?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Clear all
Read previous post:
play-banner
Android Play Audio file Tutorial

Close