android6permissions

A utility to check for (and request) permissions in Android.
https://github.com/player-03/android6permissions

To install, run:

haxelib install android6permissions 0.2.1 

See using Haxelib in Haxelib documentation for more information.

README.md

Android 6 Permissions

A utility to check for (and request) permissions in Android 6.0 and later.

Sample usage:

import com.player03.android6.Permissions;

//...

var permission:String = Permissions.READ_EXTERNAL_STORAGE;

//If we already have the permission, go ahead and use it.
if(Permissions.hasPermission(permission)) {
    loadFromFile(file);
} else {
    //Before requesting the permission, we may want to explain why we need it.
    if(Permissions.shouldShowRequestPermissionRationale(permission)) {
        showRationale().then(Permissions.requestPermission.bind(permission));
    } else {
        //If that isn't necessary, we can request it immediately.
        Permissions.requestPermission(permission);
    }
}

//Once the permission is granted, immediately start loading.
Permissions.onPermissionsGranted.add(function(permissions:Array<String>) {
    if(permissions.indexOf(Permissions.READ_EXTERNAL_STORAGE) >= 0) {
        loadFromFile(file);
    }
});
Contributors
player_03
Version
0.2.1
Published
4 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂