Permissions
First of all, we need to understand the need for permissions. Permissions were introduced to let the user know what kind of operations the application will perform. These operations are potentially using services with a cost, for example, sending an SMS message or connecting to the Internet or getting potentially sensitive information from the phone or the user. As malicious applications might potentially abuse this, Android introduced a permission mechanism that will show all the required permissions to the user when he/she installs the application from Google Play. As this method did not show very clearly how these features that require special permission were used, Google introduced, in Android Marshmallow or API version 23, a new permission mechanism to check permissions at application runtime.
Android M permission mechanism
Permissions have to be declared in the Manifest
file as with previous versions of Android, but there are some new methods to check and request permissions...