I want to create a image overlay, behaving like the "chat head service" of the Facebook app, but which will show or hide depending on the application currently in the foreground. For example, if the app currently in the foreground is Gmail or Hangouts, the image overlay should be visible, else it should be gone.
I had no problem with creating and running the service which shows the overlay, with the drag-and-drop feature and all. I'm stuck with how the service can show or hide the overlay, in other terms how it can precisely detect foreground change.
I have read many posts suggesting ActivityManager.getRunningTasks(), but this feature is deprecated since Lollipop, and does not work correctly since.
Some other suggestions are about using Accessibility Service, but I do not want to use it, mainly because my app has nothing to do with accessibility.
The exact behavior that I want to reproduce is the one implemented in the "Popemoji" app. It may not be a brilliant design, but it works consistently on Android 4+, and it does not require Accessibility permissions.
Thanks for your time,
Related
Does anybody know if there is a generic way to check if the screen is currently being presented, e.g. via Miracast, Chromecast or any other app?
My app runs in the background and shows notifications every now and then. I'd like to avoid that while the screen is visible to others.
I am trying to make an app that its behavior was like cover app, where I can show clocks, answer or reject a call, control music and more.
But I have problems with Android Oreo.
In previous versions I could do it with the indicator TYPE_SYSTEM_ERROR, and with this indicator I could put my view above all the other views, including, on the view of the call.
But with Android Oreo I try to do the same with TYPE_APPLICATION_OVERLAY.
It partially work, but It doesn´t work with phone screen, with this flag when a call is incoming the native call screen is on top of my app, and I dont want that.
I can put my app on priv_app folder. And I can have system permissions.
What can I do?
The error is,
the code is,
A little background first. I'm developing an application for corporate devices running on the Android platform. It won't be distributed on the Play store and thus, is unavailable to the general public. The devices are owned by the company and its only purpose is to run this application. So accessing the home screen/notifications/application history/ app drawer are unnecessary and in fact we want to focus the user experience directly on this application.
The current problem I'm facing is preventing access to the notification tray. Simply making the application full screen is not a solution. We do actually need to see the status bar. It's the easiest way to provide network,gps and battery status information to the user.
So far my research has only turned up one solution, which is to go full screen (again, not a solution for this problem, I need the status bar to be visible).
Can anyone help me out !!
I'm working on an application which contains a transparent screen and I need other applications such as Google Maps to run behind it, is there a way to run 2 apps simultaneously ?
Currently when I open my app all I see behind it is the menu displaying all opened apps, but can't figure out how to keep apps running behind mine.
I'm working on an application which contains a transparent screen and I need other applications such as Google Maps to run behind it
Given the fact that other developers write those other applications, you have no reliable way to knowing exactly what the user can see through the transparent portion of your UI. That will vary based on device, version of the other app, etc.
Currently when I open my app all I see behind it is the menu displaying all opened apps
What is visible through your transparent portion of your UI is whatever activity happens to be behind it.
can't figure out how to keep apps running behind mine
The decision of what other apps do is up to the developers of those other apps, not you.
is there a way to run 2 apps simultaneously ?
You are certainly welcome to start some activity (e.g., a map), and then some time later start some other activity (e.g., the one of yours with the transparent pane). What the other app does, when you do this, is up to the developers of the other app, not you.
A little background first. I'm developing an application for corporate devices running on the Android platform. It won't be distributed on the Play store and thus, is unavailable to the general public. The devices are owned by the company and its only purpose is to run this application. So accessing the home screen/notifications/application history/ app drawer are unnecessary and in fact we want to focus the user experience directly on this application.
The current problem I'm facing is preventing access to the notification tray. Simply making the application full screen is not a solution. We do actually need to see the status bar. It's the easiest way to provide network,gps and battery status information to the user.
So far my research has only turned up one solution, which is to go full screen (again, not a solution for this problem,I need the status bar to be visible). I know there's a number of lock screen apps that are able to do this so there must be a way. I just haven't found it yet.
I am not sure, but probably that you can't just lock notification bar from the application level. Android app is isolated from the Operating System and another apps, so it is not able to lock OS features.
Solution that came into my head is to make app fullscreen and create Your own status bar with battery level, current time and network status. It is not hard.
Another solution would be to prepare Your own Android distribution :)
Moreover probably You would like to override all buttons (home, back, search) so user is not able to leave your app.
Very likely is not going to be possible on a Stock device, you'd have to root and potentially install your own version of the OS to allow for this behavior. The system was purposefully made to disallow applications from having this type of behavior. The creators of the OS had the general public in mind as users, and they wanted to prevent applications from being able to "lock" the user out of portions of the device.
Much easier solution like #Jacek states is go full screen and make your own View to display whatever info that you do want from the Notifications bar, AFAIK there are public APIs to access all of that information.