B4A Class Marshmallow Permissions

Since there is currently no native support for the new permission system in Android 6.0 Marshmallow I wrote a little class for it.

How to use this:

- This Class needs the Phone and the JavaObject Library
- Set the targetSdkVersion in your manifest to at least 23
Add the permission you want to request to your Manifest

- Put the following code in your project:
Sub Globals

    Private Permission As Mpermission

End Sub

Sub Activity_Create(FirstTime As Boolean)


    If Permission.CheckPermission ("android.permission.CAMERA") = False Then
        Permission.RequestPermission ("android.permission.CAMERA")
    End If

End Sub

Update Nov 10 2015:
- Added option to show rationale
- Added a simple sample project

Update Mar 14 2016:
- CheckPermission returns alsways "True" when SDK Version < 23



  • ExampleProject.zip
    8.2 KB · Views: 273
  • Mpermission.bas
    2.3 KB · Views: 304
Last edited: