Check if Android is presenting its screen - android

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.

Related

Android - How to make an app displayed in a small screen while the rest of screen is still visible and clickable

I have a request to reduce my app screen size and the rest of the screen space are still visible and clickable for user.
It means when my app is running, user can click some icons or buttons outside of my application.
What I found are using such as Dialogs or Multiple Fragments. However, those solutions are useful when all are in your main activity. But in my case, the rest of the screen is from Home screen or other screens, not from my app screen.
Could someone have an idea for this kind of concept?
Here is my request concept image
Searching from internet
You don't need to do anything for this. Android supports splitt screen since Android 7.0.
Alternatively you can enable Picture-In-Picture mode for your app which is supported since Android 8.

How to mirror android screen/app to a screen programatically?

I am developing an android application and I'm trying to implement a button which initiates a screen mirror to a selected device.
I want it to be as straigth forward as possible, but the best i've been able to do is have it open the cast settings on the Settings app, which isn't a proper solution. It would be ideal to start screen mirroring with a single click.
Problem is i've tried using Googles Cast SDK but that only allows me to build custom HTML cast receivers, which isn't what I want, I just need a screen mirror from the android device to a screen/TV.
Is there any Android module/API that would allow me to do this with a single click, even if I have to use a Chromecast/Miracast device connected to the screen?
No, sorry, this is not an option AFAIK.
At least part of this is privacy/security. You seem to want to be able to start screen mirroring purely from app code ("I'm trying to implement a button", "allow me to do this with a single click"). Your button is the "single click", and so you really want to be able to do this without user involvement at all (since there is nothing forcing that button to exist). Showing the contents of the screen on another screen that might be visible to lots of people is the sort of thing that users need to approve, which is why additional clicks will be required.
In addition, there may be more than one target for screen mirroring within range, and the user needs to be able to choose which one to use, if any.
Combine all that with limited support for wireless displays across the various Android device manufacturers, and there really isn't anything here for what you want.

Running two applications simultaneously

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.

Can an app take a screenshot while running in the background?

Is it possible to programmatically take a screenshot of the screen while in a different app by some kind of a gesture in android? I want my app to run in background and when the user makes a particular gesture, I want my app(running in background to take a screen shot to be sent somewhere). I also want this gesture to recognize nearby devices that has my app to be able to get the screen shot for manipulation. I am still learning android, and I am planning this as my project. Just wanted to know if this is possible.
Yes it is possible
check, there are many app on google play for this.
Screenshot Ultimate and Screenshot UX Trial

Can I control the android device screen on in the PowerManagerService.java?

I have a question on the control of android device's screen on.
What I want to implement on android framework is that:
depend on specific application, I can control the screen to be on or not.
That is to say, if I don't want some application, let's say the AngerBirds, to make the
screen from state off to on, can I do it?
From the source code of PowerManagerService.java:
I found there is one line of code:
`policy.screenTurningOn(mScreenOnListener);`
so, is this the code to turn on the screen?
Then if I add some condition here, such as, if the current command of turnning on the screen is from
the application AngryBird, then I just ignore, and make the screen keep state off.
is this possible?
If possible, then can I get the Application context and the reason of turnning on the screen?

Categories

Resources