App-Runtime-Permissions-Android


Source link: https://github.com/mukeshsolanki/App-Runtime-Permissions-Android

Runtime Permission Library(Android)



A simple library that will remove all the boilerplate code and speed up your work with new Runtime Permissions introduced in Android M.

What are Runtime Permissions?

Google docs is here. Unlike the traditional way of asking permission Android M increased its security by enforcing apps to ask permissions on the fly as and when the user requests for a feature that requires those permissions. These permissions can also be revoked by the user at any time.

How to integrate into your app?

Integrating the library into you app is extremely easy. A few changes in the build gradle and your all ready to user Runtime permissions library. Make the following changes to build.gradle inside you app.

..... dependencies {

...
compile 'com.mukesh:permissions:<latest-version>' 
}

How to use the library?

Okay seems like you integrated the library in your project but how do you use it? Well its really easy just follow the steps below.

 AppPermissions runtimePermission = new AppPermissions(Activity currentActivity);
 

This will create an object of the Runtime Permission class for you. Make sure it's an object of com.mukesh.permissions.AppPermissions To check if the app has a specific permission you can call runtimePermission.hasPermission(String permission); or if you want to check whether the app has multiple permission you can call runtimePermission.hasPermission(String[] permissions).

or like how google requests for multiple permissions

You can request for a permission by calling runtimePermission.requestPermission(String permission, int requestCode) or request multiple permissions by calling runtimePermission.requestPermission(String[] permissions, int requestCode). However you will need to override a method on your activity inorder to wait for a callback from the library. Just add this to you activity.

@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {

  super.onRequestPermissionsResult(requestCode, permissions, grantResults);

  if (requestCode == mRequestCode) {
 //The request code you passed along with the request.
  //grantResults holds a list of all the results for the permissions requested.

 for (int grantResult : grantResults) {

if (grantResult == PackageManager.PERMISSION_DENIED) {

  Log.d("PermissionResult=>", "Denied");

  return;

}

 
}

 Log.d("PermissionResult=>", "All Permissions Granted");

  
}

}
 

That's pretty much it and your all wrapped up.

Resources

This library allows you to send simple data from WebView to Java. Sends the data via url.

Arc Layout is a view group with which you can add a arc-shaped container in your layout. Two main variables are the direction and the curvature of the arc.

Custom implementation of NavigationView for using custom layout for navigation items and header.

Getting location updates requires lots of bolierplate code in Android, You need to take care of

  • Google Play services availablity Check
  • Update Google play Service Dialog
  • Creation of GoogleApiClient and its callbacks connected,disconnected etc.
  • Stopping and releasing resources for location updates
  • Handling Location permission scenarios
  • Checking Location services are On or Off
  • Getting lastknown location is not so easy either
  • Fallback to last known location if not getting location after certain duration

Android-EasyLocation does all this stuff in background, so that you can concentrate on your business logic than handling all above

Stops the user from keep using the App after a period of time based on app build time. Mainly to have control preview versions handed out using e.g.: hockeyapp or fabric.

Simple lifecycle for your MVWhatever on Android. No kidding.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes