Show dialog from service - android

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?

Related

How to disable "Screen is Pinned" dialog android from kiosk mode

iam developing screenlock app for android using a React Native and a little annoyed with the screen pinned dialog that always appears, is there a way to just get rid of it? so what I really want is no dialogue interaction at all with the user
enter image description here
If you're calling startLockTask() and your device isn't set up as a dedicated device with your app whitelisted, then no you can't prevent it:
Otherwise, the current task will be launched into screen pinning mode. In this case, the system will prompt the user with a dialog requesting permission to use this mode. The user can exit at any time through instructions shown on the request dialog.
The dialog is there to help users understand what's happening, give permission for the app to take over their screen, and know how to get out of it later. It's baked into Android by design, so malicious apps can't cause problems - it's just a limitation you have to deal with, unless you're working with a dedicated device (which can be set up to give apps more control and users less)
Have you thought about immersive mode instead, where you hide the nav bar? The user can get out of that too by swiping to reveal the controls, but it's less intrusive. There's no way to automatically lock the user's screen with no interaction though

Android - Suggest a proper way to alert a user for an important notification

So, I'm building a Ride Hailing app and I'm still not sure of what route should I go with for alerting a user for a New Ride Reuest.
Should I go with Draw Over Other Apps to open the activity when the notification is received.
Should I use fullScreenNotificationIntent with showOnLockScreen
And if I use fullScreenNotificationIntent, the Android system not always open the activity, it shows a headsupNotification, and I will have to add and handle accept reject actions.
Need a proper professional suggestion on this.

screen overlay detected when my app loads

I am getting complaints from my customers that when they load my app, they see a "Screen Overlay Detected" alert message from the system. Note that this only occurs on Android M or higher.
The alert looks something similar to below.
http://i.stack.imgur.com/BEGzf.png
From my understanding, this is caused because some "other" app on the device is requesting the "overlay" permission. I've confirmed with my customers that if they remove the app that has the "overlay" permission, then it fixes the problem but is there anything I can do on my side?
Meaning, is there some way for me to inform the system to not allow this alert dialog to be displayed? It's distracting to my customers to see this every time they load my app and it's more frustrating to "me" that there is nothing I can do to fix this.
It seems that you are using a Screen Filtering app(the brownish overlay on the screen). Turn off and it won't bug you.1

Alert on uninstalling an android app

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

Android Notification - Popup dialog box

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.

Categories

Resources