This tip are for those who creating there app for Android Marshmallow. In android M there are no of good updates for users security but if you are developer it little increase your work at once, now i am going to explain how to add Permission or Request user for permission.

Request Permissions Android M

Step 1. In your MainActivity or any class where you need special permission like access camera or read contact etc. Add a static variable which we use to handle results

Step 2. Now inside your onCreate method add check for android and request for permission

Step 3. Now implement onRequestPermissionsResult method to handle result

Now once user allow this setting you can access that thing in your app.

for more also check Working with System Permissions

Hope this help you. 🙂