i am trying to create a dialog box to appear in the middle of the screen when my main program is not in focus and running in background. The purpose of the dialog box is to force the user to take an immediate action. I am already using the notification manager to notify the user but i would still like a old school popup dialog box.
Thanks :D
Popping up a dialog from an application running in the background is thought of as bad practice because it may confuse the user, and may annoy the user because you are disrupting the current task s/he is engaged in.
It is advised by the Android developers to use the Android notification system for tasks like these. A guide to create notifications is here: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
Dialogs are created with the Intent of the current activity. Since your app will not be in focus at the time, you cannot create a dialog.
Related
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?
When someone is uninstalling my app, I'd like to pop-up some kind of alert or dialog that asks the user why they are uninstalling my app -- kind of like a survey. This way, I can determine why they are unhappy and try to improve it.
I've determined how to detect when my app is being uninstalled using the ActivityManager + getRunningTasks, however, when I try to pop-up an alert using either AlertDialog or Dialog classes, they don't seem to show up. I am able to pop up a toast though pretty easily using the Toast class in Android.
My next attempt is going to create a system alert window -- something like this:
How to open Alert DIalog System level in android
Is there something better though?
Thanks,
J
Official Android Documentation states that you can Listen if another App has been removed, but not your own:
http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED
I have the following flow in my application and dont know how to implement this in an android way.
The user can check in the app if there is a update available, if so he can choose if he wants to download it, and once it is downloaded an update of the database takes place.
In the android documentation I only find basic description of either a progress dialog, or alert dialog but not how to have something more complex. For the sake of the example what i would like is the following.
The user clicks the check for update button
A progress dialog with checking for update pops up (which can be canceled)
If there is no update available the user gets informed and can click ok.
If there is an update available the user can choose to download it or cancel.
If he chooses to download he sees a progress bar. (with a cancel button)
Once the download is finished he sees a database updating alert dialog.
Finally he gets an all is done info and can click ok
Just an example yet what is the android way of implementing a series of dialogs like this. Wizard, series of different dialogs, one always changing one ...
Suggestion how to implement this in a recommended way would be highly appreciated
thanks
martin
Each dialog can launch the next subsequent dialog and automatically dismiss itself. Look at the DialogListeners attached to each button in example code
i have show progress bar with some limit.now after completing progress bar i want to show dialog message box. which must be came on current application..but i want that message box on any current current application....so which is better for it??whether to use service or notifications???
I would use the Notification bar.
Just think, if they are in a different app and your giant dialog suddenly pops up in the middle of the screen. How annoying, your app get's uninstalled :-)
Notifications are the way to go, they inform the user that your service is done and can happily switch to your app when they are ready.
Notification Reference
Notifications
I am writting an applications launcher (like home screen application). And I am wondering whether we can intercept the default dialog occurs when some application doesn’t respond in 5 seconds. What I want is: instead show the default alert dialog the launcher will show another dialog. I was googling for a while but haven’t found anything. Could anyone please tell me whether it is possible ?
Thank you in advance
This dialog is a system dialog, warning the user Android can't let this app do its job because it seems to have crashed. So I don't think this dialog would be allowed to be changed. Why would you want to change it anyway ?