Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alhazmy13/Gota
Simplifying Android Permissions
https://github.com/alhazmy13/Gota
Last synced: 5 days ago
JSON representation
Simplifying Android Permissions
- Host: GitHub
- URL: https://github.com/alhazmy13/Gota
- Owner: alhazmy13
- License: apache-2.0
- Created: 2015-12-08T18:13:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-10T17:43:56.000Z (almost 7 years ago)
- Last Synced: 2024-08-16T15:39:38.217Z (4 months ago)
- Language: Java
- Homepage: http://alhazmy13.net
- Size: 152 KB
- Stars: 70
- Watchers: 9
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-android - Gota - Simplifying Android Permissions. (Libraries / Runtime Permissions)
- awesome-android-libraries - Gota
- awesome-android - Gota - Simplifying Android Permissions. (Libraries / Utility)
- awesome-android-cn - 官网
README
# Gota Libary
![](https://img.shields.io/badge/Platform-Android-brightgreen.svg)
![](https://img.shields.io/crates/l/rustc-serialize.svg)
![](https://img.shields.io/badge/version-1.4.1-blue.svg)With Android 6.0 Marshmallow, Google introduced a new permission model that allows users to better understand why an application may be requesting specific permissions. Rather than the user blindly accepting all permissions at install time, the user is now prompted to accept permissions as they become necessary during application use. As you probably already know, such a change requires efforts on the part of the application developer, this libary will help you to requset any number of permissions with a simple way.
You can report any issue on issues page. **Note: If you speak Arabic, you can submit issues with Arabic language and I will check them. :)**
------
## Install
**Maven**```xml
net.alhazmy13.Gota
libary
1.4.1```
**Gradle**
```gradle
dependencies {
compile 'net.alhazmy13.Gota:libary:1.4.1'
}
```------
# UsageAfter adding the library, you just need to create an instance from Gota libary and passing an array of permissions.
```java
new Gota.Builder(this)
.withPermissions(Manifest.permission.CAMERA,Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.CALL_PHONE)
.requestId(1)
.setListener(this)
.check();
```
### `OnRequestPermissionsBack`
In order to receive the response, you will need to implement the `OnRequestPermissionsBack` interfaces.```java
@Override
public void onRequestBack(int requestId, @NonNull GotaResponse gotaResponse) {
if(gotaResponse.isGranted(Manifest.permission.CAMERA)) {
// Your Code
}
}
```### `GotaResponse` methods
* `deniedPermissions()`
* Return a list of denied permissions.
* `grantedPermissions()`
* Return a list of grated permissions.
* `isGranted(String)`
* To check if the permission was granted or not.
* `isDenied(String)`
* To check if the permission was denied or not.
* `isAllGranted()`
* return true if the all permission was grated
* `isAllDenied()`
* return true if the all permission was denied
* `hasDeniedPermission()`
* return true if there's any denied permission
* `isOnNeverAskAgain()`
* return true if there's any permission that checked as never ask for permission again.
* `requestId`
* Id or token that was submited with Gota request.
## Wiki
* [Arabic](https://github.com/alhazmy13/Gota/wiki/الشرح-بالعربي)
* [English](https://github.com/alhazmy13/Gota/blob/master/README.md)