Android library that simplifies the process of requesting permissions at runtime.

Overview

Karumi logo Dexter Build Status Maven Central Android Arsenal

This project is no longer under active development. If you are looking for an Android library to be able to request Android permissions in runtime take a look here

Dexter is an Android library that simplifies the process of requesting permissions at runtime.

Android Marshmallow includes a new functionality to let users grant or deny permissions when running an app instead of granting them all when installing it. This approach gives the user more control over applications but requires developers to add lots of code to support it.

Dexter frees your permission code from your activities and lets you write that logic anywhere you want.

Screenshots

Demo screenshot

Usage

Dependency

Include the library in your build.gradle

dependencies{
    implementation 'com.karumi:dexter:6.2.3'
}

To start using the library you just need to call Dexter with a valid Context:

public MyActivity extends Activity {
	@Override public void onCreate() {
		super.onCreate();
		Dexter.withContext(activity)
			.withPermission(permission)
			.withListener(listener)
			.check();
	}
}

Single permission

For each permission, register a PermissionListener implementation to receive the state of the request:

Dexter.withContext(this)
	.withPermission(Manifest.permission.CAMERA)
	.withListener(new PermissionListener() {
		@Override public void onPermissionGranted(PermissionGrantedResponse response) {/* ... */}
		@Override public void onPermissionDenied(PermissionDeniedResponse response) {/* ... */}
		@Override public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {/* ... */}
	}).check();

To make your life easier we offer some PermissionListener implementations to perform recurrent actions:

  • BasePermissionListener to make it easier to implement only the methods you want. Keep in mind that you should not call super methods when overriding them.
  • DialogOnDeniedPermissionListener to show a configurable dialog whenever the user rejects a permission request:
PermissionListener dialogPermissionListener =
	DialogOnDeniedPermissionListener.Builder
		.withContext(context)
		.withTitle("Camera permission")
		.withMessage("Camera permission is needed to take pictures of your cat")
		.withButtonText(android.R.string.ok)
		.withIcon(R.mipmap.my_icon)
		.build();
  • SnackbarOnDeniedPermissionListener to show a snackbar message whenever the user rejects a permission request:
PermissionListener snackbarPermissionListener =
	SnackbarOnDeniedPermissionListener.Builder
		.with(view, "Camera access is needed to take pictures of your dog")
		.withOpenSettingsButton("Settings")
        .withCallback(new Snackbar.Callback() {
            @Override
            public void onShown(Snackbar snackbar) {
                // Event handler for when the given Snackbar is visible
            }
            @Override
            public void onDismissed(Snackbar snackbar, int event) {
                // Event handler for when the given Snackbar has been dismissed
            }
        }).build();
  • CompositePermissionListener to compound multiple listeners into one:
PermissionListener snackbarPermissionListener = /*...*/;
PermissionListener dialogPermissionListener = /*...*/;
PermissionListener compositePermissionListener = new CompositePermissionListener(snackbarPermissionListener, dialogPermissionListener, /*...*/);

Multiple permissions

If you want to request multiple permissions you just need to call withPermissions and register an implementation of MultiplePermissionsListener:

Dexter.withContext(this)
	.withPermissions(
		Manifest.permission.CAMERA,
		Manifest.permission.READ_CONTACTS,
		Manifest.permission.RECORD_AUDIO
	).withListener(new MultiplePermissionsListener() {
	    @Override public void onPermissionsChecked(MultiplePermissionsReport report) {/* ... */}
	    @Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {/* ... */}
	}).check();

The MultiplePermissionsReport contains all the details of the permission request like the list of denied/granted permissions or utility methods like areAllPermissionsGranted and isAnyPermissionPermanentlyDenied.

As with the single permission listener, there are also some useful implementations for recurring patterns:

  • BaseMultiplePermissionsListener to make it easier to implement only the methods you want. Keep in mind that you should not call super methods when overriding them.
  • DialogOnAnyDeniedMultiplePermissionsListener to show a configurable dialog whenever the user rejects at least one permission:
MultiplePermissionsListener dialogMultiplePermissionsListener =
	DialogOnAnyDeniedMultiplePermissionsListener.Builder
		.withContext(context)
		.withTitle("Camera & audio permission")
		.withMessage("Both camera and audio permission are needed to take pictures of your cat")
		.withButtonText(android.R.string.ok)
		.withIcon(R.mipmap.my_icon)
		.build();
  • SnackbarOnAnyDeniedMultiplePermissionsListener to show a snackbar message whenever the user rejects any of the requested permissions:
MultiplePermissionsListener snackbarMultiplePermissionsListener =
	SnackbarOnAnyDeniedMultiplePermissionsListener.Builder
		.with(view, "Camera and audio access is needed to take pictures of your dog")
		.withOpenSettingsButton("Settings")
        .withCallback(new Snackbar.Callback() {
            @Override
            public void onShown(Snackbar snackbar) {
                // Event handler for when the given Snackbar is visible
            }
            @Override
            public void onDismissed(Snackbar snackbar, int event) {
                // Event handler for when the given Snackbar has been dismissed
            }
        })
		.build();
  • CompositePermissionListener to compound multiple listeners into one:
MultiplePermissionsListener snackbarMultiplePermissionsListener = /*...*/;
MultiplePermissionsListener dialogMultiplePermissionsListener = /*...*/;
MultiplePermissionsListener compositePermissionsListener = new CompositeMultiplePermissionsListener(snackbarMultiplePermissionsListener, dialogMultiplePermissionsListener, /*...*/);

Handling listener threads

If you want to receive permission listener callbacks on the same thread that fired the permission request, you just need to call onSameThread before checking for permissions:

Dexter.withContext(context)
	.withPermission(permission)
	.withListener(listener)
	.onSameThread()
	.check();

Showing a rationale

Android will notify you when you are requesting a permission that needs an additional explanation for its usage, either because it is considered dangerous, or because the user has already declined that permission once.

Dexter will call the method onPermissionRationaleShouldBeShown implemented in your listener with a PermissionToken. It's important to keep in mind that the request process will pause until the token is used, therefore, you won't be able to call Dexter again or request any other permissions if the token has not been used.

The most simple implementation of your onPermissionRationaleShouldBeShown method could be:

@Override public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
	token.continuePermissionRequest();
}

Error handling

If you think there is an error in your Dexter integration, just register a PermissionRequestErrorListener when calling Dexter:

Dexter.withContext(context)
	.withPermission(permission)
	.withListener(listener)
	.withErrorListener(new PermissionRequestErrorListener() {
		@Override public void onError(DexterError error) {
			Log.e("Dexter", "There was an error: " + error.toString());
		}
	}).check();

The library will notify you when something bad happens. In general, it is a good practice to, at least, log every error Dexter may throw but is up to you, the developer, to do that.

IMPORTANT: Remember to follow the Google design guidelines to make your application as user-friendly as possible.

Permission dialog not being shown

If you are using the MultiplePermissionsListener and you don't see the permission dialog the second time the permission is checked review your configuration. Keep in mind you need to let Dexter know the rationale you can show was closed or not by calling token?.continuePermissionRequest(). If you don't do this, the next time the permission is requested, the OS dialog asking for this permission won't be shown. You can find more information about this in here. This is an example of how a multiple permission request should be implemented:

button.setOnClickListener {
    Dexter.withContext(this@MainActivity)
                        .withPermissions(
                            Manifest.permission.ACCESS_COARSE_LOCATION
                            ,Manifest.permission.ACCESS_FINE_LOCATION)
                        .withListener(object: MultiplePermissionsListener {
                            override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
                                report?.let {
                                    if(report.areAllPermissionsGranted()){
                                        toast("OK")
                                    }
                                }
                            }
                            override fun onPermissionRationaleShouldBeShown(
                                permissions: MutableList<PermissionRequest>?,
                                token: PermissionToken?
                            ) {
                                // Remember to invoke this method when the custom rationale is closed
                                // or just by default if you don't want to use any custom rationale.
                                token?.continuePermissionRequest()
                            }
                        })
                        .withErrorListener {
                            toast(it.name)
                        }
                        .check()
}

Caveats

  • For permissions that did not exist before API Level 16, you should check the OS version and use ContextCompat.checkSelfPermission. See You Cannot Hold Non-Existent Permissions.
  • Don't call Dexter from an Activity with the flag noHistory enabled. When a permission is requested, Dexter creates its own Activity internally and pushes it into the stack causing the original Activity to be dismissed.
  • Permissions SYSTEM_ALERT_WINDOW and WRITE_SETTINGS are considered special by Android. Dexter doesn't handle those and you'll need to request them in the old fashioned way.

Contributors

Thank you all for your work!


Carlos Morera de la Chica

Alex Florescu

Pedro Veloso

Dion Segijn

Christian Panadero

Vignesh

Andy French

Bernat Borrás Paronella

Bastien Paul

Bas Broek

Bartek Lipinski

emmano

Konrad Morawski

Hrant Alaverdyan

Carla

Pavel Stepanov

Emmett Wilson

Max

Al B.

Vladislav Bauer

Jc Miñarro

handrenliang

jcruzsousa

lzdon

Do you want to contribute?

Feel free to add any useful feature to the library, we will be glad to improve it with your help.

Keep in mind that your PRs must be validated by Travis-CI. Please, run a local build with ./gradlew checkstyle build test before submiting your code.

Libraries used in this project

License

Copyright 2015 Karumi

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.
Comments
  • MultiplePermissionsListener REQUEST_ONGOING

    MultiplePermissionsListener REQUEST_ONGOING

    Expected behaviour

    Call onPermissionsChecked with already granted permissions

    Actual behaviour

    when I ask for permissions it call onError(DexterError error) with REQUEST_ONGOING error Activity was closed and opened several times using startActivityForResult setResult(OK) or CANCEL before this happened.

    Steps to reproduce

     Dexter.withActivity(getActivity())
                    .withPermissions(
                            Manifest.permission.CAMERA,
                            Manifest.permission.READ_EXTERNAL_STORAGE
                    ).withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    if (report.areAllPermissionsGranted()) {
                        openCamera();
                    } else {
                        requestMultiplePermissions();
                     }
                       }
    
                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                    token.continuePermissionRequest();
                }
            }).withErrorListener(new PermissionRequestErrorListener() {
                @Override
                public void onError(DexterError error) {
                    int y = 0; 
                }
            }).check();
    

    Version of the library

    3.0.0

    bug 
    opened by thats-bot 20
  • Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.karumi.dexter.DexterInstance.onActivityReady(android.app.Activity)' on a null object reference

    Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.karumi.dexter.DexterInstance.onActivityReady(android.app.Activity)' on a null object reference

    Expected behaviour

    To work without crashing.

    Actual behaviour

    Received crash reports from several users with the folosing stacktrace:

    Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{MYPACKAGE/com.karumi.dexter.DexterActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.karumi.dexter.DexterInstance.onActivityReady(android.app.Activity)' on a null object reference
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3254)
           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
           at android.app.ActivityThread.access$1100(ActivityThread.java:222)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
           at android.os.Handler.dispatchMessage(Handler.java:102)
           at android.os.Looper.loop(Looper.java:158)
           at android.app.ActivityThread.main(ActivityThread.java:7237)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.karumi.dexter.DexterInstance.onActivityReady(android.app.Activity)' on a null object reference
           at com.karumi.dexter.Dexter.onActivityReady(Dexter.java:138)
           at com.karumi.dexter.DexterActivity.onCreate(DexterActivity.java:31)
           at android.app.Activity.performCreate(Activity.java:6876)
           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3207)
           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
           at android.app.ActivityThread.access$1100(ActivityThread.java:222)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
           at android.os.Handler.dispatchMessage(Handler.java:102)
           at android.os.Looper.loop(Looper.java:158)
           at android.app.ActivityThread.main(ActivityThread.java:7237)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    

    Steps to reproduce

    I didn't have any crashes on my device but this is how the library is used. In an Activity:

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.activity_login);
            PermissionListener dialogPermissionListener =
                    DialogOnDeniedPermissionListener.Builder
                            .withContext(this)
                            .withTitle("Title")
                            .withMessage("Message")
                            .withButtonText(android.R.string.ok)
                            .withIcon(R.mipmap.ic_launcher)
                            .build();
            Dexter.withActivity(this)
                    .withPermission(Manifest.permission.GET_ACCOUNTS)
                    .withListener(dialogPermissionListener).check();
    }
    

    Version of the library

    3.0.0

    bug 
    opened by cioraneanu 18
  • Keep execution context on permission requested

    Keep execution context on permission requested

    @pedrovgs here is the PR to keep the execution context.

    As you pointed out to add a public method to keep the execution context I did so.

    But there is another possibility. We could use the old DexterInstance.checkPermission() method to just return the listener callbacks on the same thread that calls the method.

    If you rather go for the 2 public methods option, then I'd rename the old DexterInstance.checkPermission() to DexterInstance.checkPermissionOnMainThread(), as the method to check permission on the same thread is called DexterInstance.checkPermissionOnSameThread(). I think this will make more evident the purpose of both methods.

    Thanks.

    Fix #31

    opened by CarlosMChica 17
  • No way to synchronize Dexter requests, sample app crashes

    No way to synchronize Dexter requests, sample app crashes

    Hi there, the library looks promising, thanks. However it's very easy to crash your sample app, all it takes is tapping on a couple of buttons rapidly (before the dialog box pops up):

    FATAL EXCEPTION: main
    Process: com.karumi.dexter.sample, PID: 2514
    java.lang.IllegalStateException: Only one Dexter request at a time is allowed
        at com.karumi.dexter.DexterInstance.checkNoDexterRequestOngoing(DexterInstance.java:215)
        at com.karumi.dexter.DexterInstance.checkPermissions(DexterInstance.java:80)
        at com.karumi.dexter.DexterInstance.checkPermission(DexterInstance.java:69)
        at com.karumi.dexter.Dexter.checkPermission(Dexter.java:57)
        at com.karumi.dexter.sample.SampleActivity.onContactsPermissionButtonClicked(SampleActivity.java:74)
        at com.karumi.dexter.sample.SampleActivity$$ViewBinder$3.doClick(SampleActivity$$ViewBinder.java:43)
        at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
        at android.view.View.performClick(View.java:5198)
        at android.view.View$PerformClick.run(View.java:21147)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    

    How could it be prevented? isRequestingPermission is private and invisible from outside, so the only way would be to create an own wrapper around Dexter and track all permission requests ourselves, but this feels cumbersome. Any ideas?

    enhancement 
    opened by Konrad-Morawski 15
  • Permissions dialog not working in fragment

    Permissions dialog not working in fragment

    Expected behaviour

    Actual behaviour

    Steps to reproduce

    MainActivity permission allow then replace a fragment in activity. From fragment location permission checked with Dexter permission allow dialogue not appeared.

    Dexter.withActivity(getActivity())
                        .withPermissions(
                                Manifest.permission.ACCESS_COARSE_LOCATION,
                                Manifest.permission.ACCESS_FINE_LOCATION
                        ).withListener(new MultiplePermissionsListener() {
                    @Override
                    public void onPermissionsChecked(MultiplePermissionsReport report) {
                        /* ... */
    
                    }
    
                    @Override
                    public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                        /* ... */
                        // token.continuePermissionRequest();
                    }
                }).check();
    

    Version of the library

    bug help wanted 
    opened by sathishmscict 12
  • "All com.android.support libraries must use the exact same version specification"

    Hello, thanks for your great library !

    I get the error in my build.gradle on this line compile 'com.android.support:appcompat-v7:25.2.0' :

    All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).

    I can still run the project, but the compile line is underlined in red and it annoys me a bit ...

    Do you have any suggestion ? Thanks !

    opened by omaraflak 12
  • Permissions dialog not restored correctly when pressing home

    Permissions dialog not restored correctly when pressing home

    Android's permission dialog is not restored if you press home while showing the permissions dialog and return to the activity that was showing it.

    Actual behaviour

    A DexterError.REQUEST_ONGOING is thrown. Obviously, this is correct, as I never allowed nor denied the permission, but I'm unable to continue the permission by using Dexter.withActivity(activity).continueRequestingPendingPermissions(permissionListener)

    Expected behaviour

    It should restore the dialog after calling Dexter.withActivity(activity).continueRequestingPendingPermissions(permissionListener).

    Steps to reproduce

    Request a permission Press home when the allow/deny dialog is shown Re-open the activity that showed the permissions dialog

    Version of the library

    3.0.2

    bug 
    opened by edualonso 12
  • Add rotate screen support. #14 and #15

    Add rotate screen support. #14 and #15

    To be able to implement the feature requested at #14 and the example requested at #15 I've implemented the screen rotation support. This could be implemented out of the library but it was quite straightforward to implemented it inside Dexter, so I decided to add this feature to the project instead of add it to the example project.

    To be able to support this feature the only thing our users has to do is to call a method in the onCreate Activity method where the library is used. I've updated the README.md with some documentation.

    Please @greysonp check if this feature is enough or if you need something more specific.

    opened by pedrovgs 11
  • NullPointerException on Activity.finish

    NullPointerException on Activity.finish

    Caused by java.lang.NullPointerException Attempt to invoke virtual method 'void android.app.Activity.finish()' on a null object reference com.karumi.dexter.DexterInstance.onPermissionsChecked (Unknown Source:27) com.karumi.dexter.DexterInstance.updatePermissionsAsDenied (Unknown Source:36) com.karumi.dexter.DexterInstance.onPermissionRequestDenied (Unknown Source) com.karumi.dexter.Dexter.onPermissionsRequested (Unknown Source:11) com.karumi.dexter.DexterActivity.onRequestPermissionsResult (Unknown Source:46) android.app.Activity.dispatchRequestPermissionsResult (Activity.java:7825) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:836)

    bug 
    opened by tritueviet 10
  • Fix issue where Lopper.loop() is called even if a looper already exists

    Fix issue where Lopper.loop() is called even if a looper already exists

    I have run into a bug where execution flow blocked in Lopper.loop() called from Dexter, whereas I wanted that execution continue. Indeed, execution thread of Dexter was run from a handler. So a Looper already exists !

    This is the reason of this commit.

    opened by bastienpaulfr 9
  • Translucent animation flickering when checking for already granted permission

    Translucent animation flickering when checking for already granted permission

    Expected behaviour

    If all requested permissions are already granted when invoking one of the Dexter.checkPermission(s)(OnSameThread), startTransparentActivityIfNeeded() should not start DexterActivity. Thus preventing any kind of flicker and animation when opening/closing activities.

    Actual behaviour

    When checking for permissions already granted, I get a slight flicker and slide animation with a translucent activity with a few shadows.

    Steps to reproduce

    I have no clue... I have two classes, implemented with the same exact pattern, one of them shows the flicker, the other doesn't. They check for different permissions but I tried to replicate everything in the working class into the non-working class but I can't get it to work.

    For some strange reason, I have a piece of code fully working (no flicker, no animation) and another piece of code not working (shows flicker, shows animation). I can't really understand the differences between them to describe the steps to reproduce.

    That's why I'm suggesting to not even start DexterActivity if all required permissions are already granted. I know this is supposed to be a translucent activity, but why are we opening it if we are going to close it right away since there are no dialogs to show?

    Version of the library

    v2.3.0

    opened by rfgamaral 9
  • Android 11 dismissible permission dialogs

    Android 11 dismissible permission dialogs

    In android 11 I noticed this flow- permissions popups are dismissible, and when the user dismisses any permission popup, we get a callback like user-selected ‘never ask again’

    We need to add a check if at least anyone permission is denied earlier and RationaleShouldBeShown is false that means at least one permission is permanently denied, that time we need to show settings dialog.

    I have implemented this new change w.r.to Android11 API30 for this here

    opened by droid-lover 2
  • API 30 Android 11: Requesting background location permission

    API 30 Android 11: Requesting background location permission

    Expected behaviour

    Show the same permission dialog as in API 29

    Actual behaviour

    Nothing happens. Permission dialog is being ignored

    If your app targets Android 11 or higher, the system enforces this best practice. If you request a foreground location permission and the background location permission at the same time, the system ignores the request and doesn't grant your app either permission. https://developer.android.com/about/versions/11/privacy/location#request-background-location-separately

    https://developer.android.com/training/location/permissions#request-background-location

    As i understand, i have to ask user for foreground location permission first, and then after giving permission i have to ask again for a background permission...

    Steps to reproduce

    in build.gradle change targetSdkVersion 30 and compileSdkVersion 30 use emulator API 30

    just copy to mainActivity and call requestAccessFineLocation() from onCreate(...)

    private fun requestAccessFineLocation() {
            Dexter.withContext(this)
                .withPermissions(createPermissionList1())
                .withListener(object : MultiplePermissionsListener {
                    override fun onPermissionsChecked(report: MultiplePermissionsReport) {
                        Log.i("myApp", "onPermissionsChecked1 = " + report.areAllPermissionsGranted())
    
                    }
    
                    override fun onPermissionRationaleShouldBeShown(
                        permissions: MutableList<PermissionRequest>,
                        token: PermissionToken
                    ) {
    
                        Log.i("myApp", "onPermissionRationaleShouldBeShown1")
                        token.continuePermissionRequest()
                    }
    
    
                }).check()
        }
        private fun createPermissionList1(): MutableList<String> {
            val permissionList = mutableListOf(
                Manifest.permission.ACCESS_FINE_LOCATION,
                Manifest.permission.ACCESS_BACKGROUND_LOCATION
    
            )
            return permissionList
        }
    

    Version of the library

    implementation 'com.karumi:dexter:6.2.2' or implementation 'com.karumi:dexter:4.2.0' (i changed withContext(...) to withActivity(...))

    bug help wanted 
    opened by dds861 0
  • ACTIVITY_RECOGNITION Permission

    ACTIVITY_RECOGNITION Permission

    Expected behaviour - Work correct :)

    Actual behaviour - Dosnt work.

    Steps to reproduce -

    After clicking on permission dialog deny button close app and open again . And after that when you clicking allow or deny button it dosnt call onPermissionDenied or onPermissionRationaleShouldBeShown function. This happening only with ACTIVITY_RECOGNITION permission, i try it with location,camera, phone and other permissions, all work.

    Version of the library-6.2.2

    bug help wanted 
    opened by SergeyAvetisyan 1
  • (1). cannot resolve withContext method.  (2). cannot resolve permission Symbol

    (1). cannot resolve withContext method. (2). cannot resolve permission Symbol

    java code

    package com.example.sunona;

    import androidx.appcompat.app.AppCompatActivity;

    import android.os.Bundle; import android.widget.ListView;

    import com.karumi.dexter.Dexter;

    import java.util.jar.Manifest;

    public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setContentView(R.layout.activity_main);
    
        Dexter**.withContext(this)**   ///cannot resolve withContext method.
                .withPermission(Manifest.**permission**.Read_External_Storage)  /// cannot resolve permission Symbol
                .withListener()
                .check();
    }
    

    }

    opened by sachinburdak 1
  • Screen rotation while showing Rationale dialog invalidates PermissionListener

    Screen rotation while showing Rationale dialog invalidates PermissionListener

    Expected behaviour

    PermissionListener passed to withListener() function is triggered after permission request.

    Actual behaviour

    PermissionListener is invalidated on screen rotation and its callbacks are not triggered.

    Steps to reproduce

    Rotate screen while showing dialog from onPermissionRationaleShouldBeShown callback.

    Version of the library

    6.2.2

    I suppose that using ViewModel for DexterActivity should fix the problem, but it requires jetpack dependency.

    bug 
    opened by nsk90 13
  • java.lang.IllegalArgumentException  ERROR IN device API 23

    java.lang.IllegalArgumentException ERROR IN device API 23

    ERROR CLOSE ACTIVITY

    java.lang.RuntimeException: at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3319) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3415) at android.app.ActivityThread.access$1100 (ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1821) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:148) at android.app.ActivityThread.main (ActivityThread.java:7325) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120) Caused by: java.lang.IllegalArgumentException: at android.os.Parcel.readException (Parcel.java:1624) at android.os.Parcel.readException (Parcel.java:1573) at android.content.pm.IPackageManager$Stub$Proxy.shouldShowRequestPermissionRationale (IPackageManager.java:3682) at android.app.ApplicationPackageManager.shouldShowRequestPermissionRationale (ApplicationPackageManager.java:662) at android.app.Activity.shouldShowRequestPermissionRationale (Activity.java:4229) at androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale (ActivityCompat.java:549) at com.karumi.dexter.AndroidPermissionService.shouldShowRequestPermissionRationale (SourceFile) at com.karumi.dexter.DexterInstance.handleDeniedPermissions (SourceFile) at com.karumi.dexter.DexterInstance.onActivityReady (SourceFile) at com.karumi.dexter.Dexter.onActivityReady (SourceFile) at com.karumi.dexter.DexterActivity.onCreate (SourceFile) at android.app.Activity.performCreate (Activity.java:6904) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1136) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3266)

    Coding

    Dexter.withContext(this).withPermissions(
                    listOf(
                        android.Manifest.permission.ACCESS_FINE_LOCATION,
                        android.Manifest.permission.ACCESS_COARSE_LOCATION,
                        Manifest.permission.CAMERA,
                        Manifest.permission.READ_EXTERNAL_STORAGE,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE
                    )
                ).withListener(object : MultiplePermissionsListener {
                    override fun onPermissionsChecked(p0: MultiplePermissionsReport?) {
                        when(destination.id){
                            R.id.register->{
                                toolbar_main.show()
                            }
                            R.id.galleryFragment->{
                                toolbar_main.hide()
                            }
                            else->{
                                toolbar_main.show()
                                viewodel.imageSelect.postValue("")
                            }
                        }
                    }
    
                    override fun onPermissionRationaleShouldBeShown(
                        p0: MutableList<com.karumi.dexter.listener.PermissionRequest>?,
                        p1: PermissionToken?
                    ) {
                        p1!!.continuePermissionRequest()
                    }
                }).check()
    

    DEVICEE

     Error in J5 android 6 api 23 
    

    VERSION

    implementation 'com.karumi:dexter:6.2.1'

    bug help wanted 
    opened by cesarwillymc 1
Releases(6.2.3)
  • 6.2.1(Jul 7, 2020)

  • 6.2.0(Jun 8, 2020)

  • 6.0.1(Dec 2, 2019)

  • 6.0.0(Sep 17, 2019)

  • 5.0.0(Jun 21, 2018)

  • 4.2.0(Oct 31, 2017)

  • 4.1.1(Jun 28, 2017)

  • 4.1.0(Apr 3, 2017)

  • 4.0.0(Mar 6, 2017)

    This new version of Dexter comes with a simplification of its API.

    • We no longer support screen rotations from the library and therefore have removed the methods continueRequestingPendingPermissions.
    • We have deleted the EmptyMultiplePermissionsListener and EmptyPermissionListener. BaseMultiplePermissionsListener and BasePermissionListener are the new to-go implementations.
    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Mar 6, 2017)

    With this release we are deprecating some methods and classes that won't be available in the future major version of Dexter. More specifically we are deleting:

    • Both methods called continueRequestingPendingPermissions
    • EmptyListenerclasses that are going to be replaced byBaseListenerclasses. These new listeners will provide a default implementation of the methodonPermissionRationaleShouldBeShown` continuing with the permissions process instead of having an empty implementation.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.2(Feb 1, 2017)

    In this release, we have fixed a crash in the library happening when the user changed the permissions of the app from the settings screen:

    • #107: Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.karumi.dexter.DexterInstance.onActivityReady(android.app.Activity)' on a null object reference
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Jan 25, 2017)

    With this release, we have fixed a minor issue reported by a user and found during the release 3.0.0.

    • #105: MultiplePermissionsListener REQUEST_ONGOING.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Dec 23, 2016)

    With this release, we have fully redesign the Dexter API to make it fluent.

    • Dexter now asks for an Activity instead of an Application context so that you don't have to worry about strange onResume calls when permissions have been already granted.
    • New fluent API to make the library easier to use.
    • Add a new callback for the sample snackbar listener implementation.
    Source code(tar.gz)
    Source code(zip)
  • 2.4.0(Dec 23, 2016)

    With this release, we are deprecating most of the Dexter API to offer a more fluent design:

    • Create a fluent API to call Dexter
    • Deprecate all the methods that are going to be removed in 3.0.0
    • Fix phantom activity when permissions are already granted (only when using the new API)
    • Add sample snackbar listener callback to better configure your snackbar listeners.
    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Sep 5, 2016)

    • This release fixes a bug occurring in some devices where calling checkSelfPermission throws a RuntimeException that wasn't being handled.
    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Jun 13, 2016)

  • 2.2.2(Mar 16, 2016)

  • 2.2.1(Jan 22, 2016)

  • 2.2.0(Jan 12, 2016)

    Add two new methods checkPermissionOnSameThread and checkPermissionsOnSameThread to the Dexter API to be able to request permissions and get the response in the same thread where the method was executed.

    Source code(tar.gz)
    Source code(zip)
  • 2.1.4(Dec 17, 2015)

  • 2.1.3(Dec 15, 2015)

  • 2.1.2(Dec 1, 2015)

    • Add a semantic error when Dexter is used before initializing it
    • Retrieve application context to avoid the mistake of initializing Dexter with an activity context
    Source code(tar.gz)
    Source code(zip)
  • 2.1.1(Dec 1, 2015)

  • 2.1.0(Nov 30, 2015)

    • Add continuePendingRequestIfPossible & continuePendingRequestsIfPossible to handle activity rotations while avoiding the need for library clients to store stuff in their side.
    • Add an isRequestOngoing method that returns true whether Dexter is requesting some permission.
    • Decreased minSdkVersion from 14 to 10
    • Minor fixes in both code & readme
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Nov 24, 2015)

    • Now it's possible to know if a permission has been permanently denied by accessing PermissionDeniedResponse.isPermanentlyDenied
    • Allow ask for multiple permissions at once with Dexter.checkPermissions
    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(Nov 20, 2015)

    • Allow library clients to ask again for permissions in their PermissionListener::onPermissionGranted or PermissionListener::onPermissionDenied implementations.
    Source code(tar.gz)
    Source code(zip)
Owner
Karumi
Karumi, the Rock Solid Code studio
Karumi
Android Studio project wrapper around the Elixir TodoApp Desktop app to run on Android including the Erlang runtime

TodoApp Android: An Android Sample App This Android Studio project wraps the Desktop Sample App to run on an Android phone. How to build & run Install

elixir-desktop 78 Dec 10, 2022
KotlinSample - Template project for building a GTK3 Kotlin/Native app against the elementary Flatpak runtime

GTK3 Kotlin/Native Sample This is a working example of how to write and build a

David Hewitt 10 Dec 5, 2022
React-native-user-interface - Change React Native userinterface at runtime

react-native-user-interface change RN userinterface at runtime. Installation npm

Ahmed Eid 0 Jan 11, 2022
Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs

Show worldwide headline. API/Glide library/recycler view/volley library/kotlin/xml/ chrome custom tabs. -> you can click on headline and it will open an article of that news in the app(no need to go to chrome or any browser)

SUMIT KUMAR 5 Nov 28, 2022
A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library.

Expo Music Picker A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library. Supp

Bartłomiej Klocek 60 Dec 29, 2022
:movie_camera: Movie discovery app showcasing Android best practices with Google's recommended architecture: MVVM + Repository + Offline support + Android Architecture Components + Paging library & Retrofit2.

Popular Movies Stage 1 + Stage 2 Discover the most popular and top rated movies playing. Movies data fetched using themoviedb.org API. ✨ Screenshots M

Yassin AJDI 189 Nov 26, 2022
Oratio Library for Android Studio helps you simplify your Android TTS codes

Oratio Oratio is a library for Android Studio. This library is useful to a number of developers who are currently making apps using android TTS(Text-T

Jacob Lim 1 Oct 28, 2021
Unity-Android-SDK-Plugins - Android SDK/Library/Plugins (aar) for Unity Developers

Unity Android SDK Plugins Unity Android SDK Plugins is an Open Source project th

NNK 1 Aug 14, 2022
Spantastic - an Android library that provides a simple and Kotlin fluent API for creating Android Spannable

Spantastic is an Android library that provides a simple and Kotlin fluent API for creating Android Spannable. This library wrappers SpannableStringBuilder and add methods to easily decorate the text with multiple spans.

Wellington Cabral da Silva 12 Nov 27, 2022
AndroidEssentials is an android library that creates helper functions for performing common tasks in Android

AndroidEssentials is an android library that creates helper functions for performing common tasks in Android such as managing preferences, managing files, showing alerts, showing toasts, checking user country & checking network connection of users. All the methods of the class are static and should be accessed directly from the AndroidEssentials class.

Isaac Sichangi 3 Jul 7, 2022
Utility Android app for generating color palettes of images using the Palette library. Written in Kotlin.

Palette Helper is a simple utility app made to generate color palettes of images using Google's fantastic Palette library. It's mostly a for-fun pet p

Zac Sweers 154 Nov 18, 2022
Android app built with MVP architectural approach and uses Marvel Comics API that allows developers everywhere to access information about Marvel's vast library of comics. :zap:

Villains & Heroes Android app built with MVP architectural approach and uses Marvel Comics API that allows developers everywhere to access information

André Mion 53 Jul 13, 2022
Library to change Android launcher App Icon and App Name programmatically !

AppIconNameChanger Change Android App launcher Icon and App Name programmatically ! Download Demo APK from HERE Kindly use the following links to use

Prabhakar Thota 587 Dec 29, 2022
📱 Android Library to implement Rich, Beautiful, Stylish 😍 Material Navigation View for your project with Material Design Guidelines. Easy to use.

Material NavigationView for Android ?? ?? Android Library to implement Rich, Beautiful Material Navigation View for your project with Material Design

Shreyas Patil 198 Dec 17, 2022
Utility Android app for generating color palettes of images using the Palette library. Written in Kotlin.

Palette Helper is a simple utility app made to generate color palettes of images using Google's fantastic Palette library. It's mostly a for-fun pet p

Zac Sweers 154 Nov 18, 2022
📱 AppListManager (Android Library) makes managing application and activity lists easy.

AppListManager (Android Library) AppListManager is easy to use Android library, which minimizes developing time when working on application or activit

Rokas Jankunas 60 Dec 27, 2022
An library to help android developers working easly with activities and fragments (Kotlin version)

AFM An library to help android developer working easly with activities and fragments (Kotlin) Motivation Accelerate the process and abstract the logic

Massive Disaster 12 Oct 3, 2022
Sample Project for Android Support Library 23.2

SnapShot: Contains features Vector Drawable Animated Vector Drawable AppCompat DayNight theme Bottom Sheets Using BottomSheetDialog in day-night mode.

Huqiu Liao 779 Nov 24, 2022
RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.

RoboDemo RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works. A sample is available in the download area of

Stéphane Nicolas 220 Nov 25, 2022