You have to also ask for the permission in the AndroidManifest.xml file. From Android 6.0 we need to check every permission related task. Though we have to declare the permissions in the manifest file but also have to check that whether the permission has been granted or not, if not then request for the permission.
There are two types of permissions: normal and dangerous
1) Normal Permissions: These permission are the ones which do not affect the user's privacy.If the application lists a normal permission in its manifest, then these permissions will be automatically granted by the system upon installation. These permissions include accessing wi-fi network, accessing the network state and other basic permissions.
2) Dangerous Permissions: Dangerous permission are the one's which allows the app to request the user's private data and affect the system and other apps. If any dangerous permission is listed in the manifest then the user has to explicitly give permission tot he application. These permissions include accessing camera, files, location etc.
You need to ensure that your targetSdk version is greater than 23 (marshmallow) because run-time permissions will not work below marshmallow