PermissionEverywhere

Additional

Language
Java
Version
alpha (May 3, 2016)
Created
Apr 30, 2016
Updated
Dec 10, 2018
Owner
kaknazaveshtakipishi
Contributors
invalid-email-address
ay1man4
Ognev Zair (ognev-zair)
farruxx
Sufaev
5
Activity
Badge
Generate
Download
Source code
APK file

Advertising

####Permission Everywhere

dependencies {
     compile 'com.github.kaknazaveshtakipishi:PermissionEverywhere:1.0.2'
}

###Usage ###With Callback

 PermissionEverywhere.getPermission(getApplicationContext(), 
            new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                    REQ_CODE, 
                    "Notification title", 
                    "This app needs a write permission",
                    R.mipmap.ic_launcher)
                    .enqueue(new PermissionResultCallback() {
                                @Override
                                public void onComplete(PermissionResponse permissionResponse) {
                                    Toast.makeText(TestService.this, "is Granted " + permissionResponse.isGranted(), Toast.LENGTH_SHORT).show();
                                }
            });

###On the fly(synchronized)

 @Override
  protected Boolean doInBackground(Void... params) {
      PermissionResponse response = PermissionEverywhere.getPermission(getApplicationContext(), 
      new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
              REQ_CODE,
              "Notification title", 
              "This app needs  a write permission", 
              R.mipmap.ic_launcher)
              .call();
      //waits..
      boolean isGranted = response.isGranted();

      if(isGrante){
      // Do stuff
      }
  }

License

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.