Skip to content

Latest commit

 

History

History
107 lines (82 loc) · 3.61 KB

README.md

File metadata and controls

107 lines (82 loc) · 3.61 KB

#Gota Libary ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/packagist/l/doctrine/orm.svg) ![](https://img.shields.io/badge/version-1.3.0-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

<dependency>
<groupId>net.alhazmy13.Gota</groupId>
<artifactId>libary</artifactId>
<version>1.3.0</version>
</dependency>

Gradle

dependencies {
	compile 'net.alhazmy13.Gota:libary:1.3.0'
}

Usage

After adding the library, you just need to create an instance from Gota libary and passing an array of permissions.

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.

   @Override
       public void onRequestBack(GotaResponse gotaResponse) {
           if(gotaResponse.isGranted(Manifest.permission.CAMERA)) {
              Log.d(TAG, "GRATED")
           }
       
       }

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

License


The MIT License (MIT)

Copyright (c) 2015 Abdullah Alhazmy

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.