To get a Git project into your build:
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.rkk001:PermissionUtils:Tag'
}
Android library for run-time permissions. Simply call this utils it will check run-time permissions granted or not.
This is a simple android library for run-time app permission. Instead of writing run-time permission code use this library in your project.
Just need to access a function in code whenever you need this code in your class.
Simply call a boolean funtion:-
checkPermissions(Activity name,int[] integerArray)
This function tell you permission granted or not.
Pass value of permissions whatever you need:
- READ_CALENDAR,
- WRITE_CALENDAR,
- READ_CALL_LOG,
- WRITE_CALL_LOG,
- PROCESS_OUTGOING_CALLS,
- CAMERA,
- READ_CONTACTS,
- WRITE_CONTACTS,
- GET_ACCOUNTS,
- ACCESS_FINE_LOCATION,
- ACCESS_COARSE_LOCATION,
- RECORD_AUDIO,
- READ_PHONE_STATE,
- READ_PHONE_NUMBERS,
- CALL_PHONE,
- ANSWER_PHONE_CALLS,
- ADD_VOICEMAIL
- USE_SIP,
- BODY_SENSORS,
- SEND_SMS,
- RECEIVE_SMS,
- READ_SMS,
- RECEIVE_WAP_PUSH,
- RECEIVE_MMS,
- READ_EXTERNAL_STORAGE,
- WRITE_EXTERNAL_STORAGE
For example:-
In Kotlin:- checkPermissions(this,intArrayOf(2,4,6,11))
In Java:- checkPermissions(this,new int[]{1,5,9});
Sample code:- MainActivity.class
All the permission work will be done by this utility.
Use this and make your code more robust,reliable,simple and easy to understandable.
Thank you.