Skip to content

klmpois/RuntimePermissionsHelper

 
 

Repository files navigation

RuntimePermissionsHelper

Android Runtime Permissions Helper

This library allows the usage of RxJava with the new Android M permission model.

Android M was added to check Permission. but Permission check processing is so dirty.

This Project is to be simple, Checking permissions.

Install / Download


Current version: [1.0.1]

Gradle:

repositories {
    jcenter()
}

compile 'com.github.dubulee:runtimepermissionshelper:1.0.1'

How to use

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Must be done during an initialization phase like onCreate
    RxPermissions.getInstance(this)
        .request(Manifest.permission.CALL_PHONE,
                        Manifest.permission.ACCESS_FINE_LOCATION,
                        Manifest.permission.READ_CONTACTS,
                        Manifest.permission.READ_CALENDAR)
        .subscribe(new Subscriber<Boolean>() {
                            @Override
                            public void onCompleted() {

                            }

                            @Override
                            public void onError(Throwable e) {

                            }

                            @Override
                            public void onNext(Boolean aBoolean) {
                                if(aBoolean) {
                                    Toast.makeText(MainActivity.this,
                                            "RX Permissions OK",
                                            Toast.LENGTH_SHORT).show();
                                }
                                else {
                                    Toast.makeText(MainActivity.this,
                                            "Permission denied, can't enable the camera ",
                                            Toast.LENGTH_SHORT).show();
                                }
                            }
                        });
}

Welcome the pull request

License

Copyright 2015 DUBULEE

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Android Runtime Permissions Helper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%