Recent Posts

Site Creator




Implement Runtime Permission For Location in Android Marshmallow

Posted on

Dear Friends

Now you have become experience android application developer. Congrats !. Need less to say if you want to use location services in your application you need to declare them in Android Manifest.xml as




During android application development on Android 6.0 or above when you will be dealing with runtime permission, you will deal with a call back method which gets called by the system automatically whenever a permission made by application is allowed or denied by the user. Please have a look a below snapshot




Now before this you need to request permission at runtime from user.



Android Studio will give you some compilation error  so you can protect the code as


So if user has previously provided permission  you will not enter into if block and you will  directly go to else part and do you cool thing.

Also please ensure to work with Android Runtime permission your compileSDKversion in gradle should be 23 or higher and your targetSDKversion should be 23 or higher.


if you have any question related to blog or and suggestion please visit the google form and post your query.


Code Reference :




Happy Coding.


Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.