Android Marshmallow Permissions Example

Hello friends, welcome to this new tutorial. Today I will show you Android Marshmallow Permissions Example. One of the major changes in Android Marshmallow is the new permission system. In earlier versions we were declaring the …

android marshmallow permissions example

Hello friends, welcome to this new tutorial. Today I will show you Android Marshmallow Permissions Example. One of the major changes in Android Marshmallow is the new permission system. In earlier versions we were declaring the permission in the AndroidManifest.xml file. But with Android Marshmallow we need to ask the permission at run time.  In this post I will show you a simple Android Marshmallow Permissions Example. So lets begin.

Android Marshmallow Permissions Example Video

You can watch this video before moving to the Android Marshmallow Permissions example. This is video is the demonstration of the final output.

Android Marshmallow Permissions Example Project

  • Open Android Studio and create a new Android Project. Select Empty Activity come to your project window. After these steps (we do it always :P).
  • In this example I will try to ask the permission for READING EXTERNAL STORAGE. So go to your AndroidManifest.xml file and add this permission.

  • Although we have added the permission in our Manifest but if the device is running Android Marshmallow we need to ask the permission at run time. So for asking permission at run time I will create a button. So you create a simple button at your activity_main.xml. Or copy the following code and paste it to your activity_main.xml.

  • After this come to your MainActivity.java and write the following code.

  • Thats it now you can run your application. But make sure the emulator you are using is running Android Marshmallow.
  • You can also download the source code from GitHub. Go to the link given below to get my source.

[sociallocker id=1372] Android Marshmallow Permissions Example Source Download [/sociallocker]

So thats all for this Android Marshmallow Permissions Example friends. I have explained all the codes with comments. But still if you are having any kind of confusion regarding this Android Marshmallow Permissions Example feel free to leave your comments. I will try to reply you all ASAP. Thank You 🙂

Hi, my name is Belal Khan and I am a Google Developers Expert (GDE) for Android. The passion of teaching made me create this blog. If you are an Android Developer, or you are learning about Android Development, then I can help you a lot with Simplified Coding.

Expand Your Knowledge: Next Tutorial Picks

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x