Dismiss Permission Request Dialog on Marshmallow using back button - android

In my App, I am verifying required permissions for Marshmallow devices, in accordance to google guidelines.
When the permission is required, I am using the request permissions method for that:
mActivity.requestPermissions(permissionsList, MY_PERMISSIONS_REQUEST), which displays dialogs similar to the dialog below:
While this dialog is displayed, if the user presses the back button, I would like the dialog to be dismissed. Currently, pushing the back button has no effect.
Is there a way to dismiss those dialogs using the back button?

You know what, I believe it's a bug in AOSP. It should ignore Back button for no reason.
Reported an issue to bugtracker:
https://code.google.com/p/android/issues/detail?id=231017&thanks=231017&ts=1482770758

Related

How to show a dialog without context in kotlin

I want to show a dialog to the user saying "Session expired please login again". But the problem is when I am making the network call the user might have changed the screen and the context which I passed is no longer useful to show the dialog. By changing the screen I don't mean that user changed the application they are still on the same application.
I am using one activity and on top of that there are many fragments.

Package installer dialog dismissible?

I am working so some demo app store. This app can detect deep link and install app from link. Before installing app user gets dialog (at least on Android 11 and 12) where he/she can click on Install or Cancel. Dialog is opened by PackageInstaller. I am using BroadcastReceiver to receive installation status (for example PackageInstaller.STATUS_PENDING_USER_ACTION). When user clicks on cancel or install or some error happens I receive a status.
But user can click outside of dialog. Dialog is smilingly dismissed and no status is reported back.
Is there way to get status? Or to make dialog non dismissible?
EDIT: dialog is create by PackageInstaller and I don’t have control it's properties.
Directly - no, but you can:
Track onResume event to detect when it's closed (it requires some filtering to avoid false detection);
Wrap it into some proxy activity and use startActivityForResult/onActivityResult to start that EXTRA_INTENT from STATUS_PENDING_USER_ACTION. resultCode is always 0, but you'll have an closing event at least.

How to dismiss permissions dialog programmatically?

When the user pauses/closes the screen, while a permissions prompt dialog is active, the dialog persists over the locked screen when the user tries to use the phone again (and needs to make a choice for the dialog to go away).
Although a detail, it does not look very nice, and I would like to dismiss that prompt dialog in onPause(). How can I do that? Perhaps I should programmatically choose to deny permissions in onPause() instead?
From another point of view, it is also not very nice that user can't continue his task when returning to your app.
So, persistent dialog is a feature and the point is that user decides when to deny or accept permissions - it's the best to not do anything programmatically

Show dialog from service

I'm creating a voip app and when a call comes in I need to alert the user so they can accept or reject the call. I want a dialog like what hangouts uses:
I've tried using an alert dialog with type TYPE_SYSTEM_ALERT. However there are issues with this:
It requires ugly system permissions. (takes you to a full screen activity to accept overlay permissions)
It displays centered vertically not at the top over the top bar.
Any time anyone asks about this online everyone says your shouldn't be doing it this way, but doesn't tell you how to actually do it.
I didn't have to accept any overlay system permissions on my hangouts so how does google do it?
What is the correct way to display a dialog to the user from a service to accept a call?

Bypassing dialog bug in Android

I have an application which in certain areas, a dialog pops up and restricts the user from proceeding. There are currently two types of dialogs. One restricts the user entirely from proceeding and the other allows the user to proceed if they click on "OK".
The problem:
When the dialog appears, if I close the application and relaunch it, the app bypasses the dialog and gains access to the next screen. On one of the cases, the app bypasses the screen and shows that screen which the user was previously on before the dialog appeared.
Does anyone have an idea what may be the problem?

Categories

Resources