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

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.

Related

Check if Android is presenting its screen

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.

Is there any Android app that can detect particular text on screen and click on it automatically?

I want a app that can read text on my screen and click on the text which I can pre-define in the app. App mostly capable to identify multiple texts and if anyone of them present on screen then click on that region.
Yes.
Macrodroid.
Use the Device action -> UI interaction -> Click -> Specific text
Option in the macro and it'll click that word on the screen
👍🏻
You can't. Android doesn't have APIs for screen scraping because its a huge security hole- you could use it to grab passwords, banking info, etc. Definitely not possible without a rooted device, probably not possible even with root without a lot of work (you could maybe on a rooted device grab it right from the screen data, but then you'd have to do image processing to find the actual text).

Is that possible to make timer (clock) quick access from lock screen? A calculator?

I moved from iPhone to Android (Samsung S7) and missing one feature. In iPhone I could use quick access to set clock and timer and set direct from locked screen if to press a button at quick access panel, shown at the picture with arrow. Is it possible to make a similar quick access to clock app in android from lock screen? To put it in android quick access panel or in some other way like third party app, etc: aiming to access clock app set on lock screen quick w/o logging in? Same question with Calculator app.
In Android you can do almost everything with apps.
I found here some apps that allow you to create widgets on your lockscreen, you click on them, unlock your screen, and the app launches:
https://www.maketecheasier.com/launch-apps-lockscreen-android/
I own a OnePlus so I know they have this option build in.
You can also use the Xposed module "GravityBox" or "LockscreenMods"
(it is not possible to bypass the unlockscreen through a lockscreen widget!)

Android non-root lock replacement

Let me begin by saying that, yes, I know that the stock Android lock screen can not be programatically replaced without rooting.
Now that that's over with, I want to make an app that contains a custom 'lock' mechanism. There are apps out there that emulate this functionality, namely LockGo. This allows a user to view information from widgets on a 'lock screen' and emulates the slide-to-unlock functionality (or whack-a-mole if the user wants to install that plugin).
Does anyone know what mechanism or Android API functionality they may have used to do this? Is it as simple as hooking into the power button to launch an activity, such as in the link below?
How to hook into the Power button in Android?
Any insight to this would be appreciated.
I've found out while researching this that, while there is currently no way to replace the stock security or keyguard lock (which I knew), it is possible to show an Activity on top of the lock using the following code in the setup for that Activity:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
This can be used with any logic needed to create a faux lock to show screens on top of the system lock(s), though the lock will still be in tact and the user will need to enter the lock to get into the device.

Android: any way to check if "menu" button will exist when full-screen?

My app has code to go full-screen where sensible to do so -- it's sensible on most Android 1 and 2 devices, but under Android 3 for example going full-screen loses the app menu button, and at the moment I don't implement my own menu button so users can't (or at least can't easily) get to the app's menu.
At the moment I test for Android version < 3, and go full-screen if that's the case, but I have users with Android 2 tablets (Viewsonic view pad 10s for example) where this isn't sensible (the Viewsonic user tells me she has to hold down the back button to get app's menu to appear).
Is there a better way of testing whether going full-screen will lose the menu button? Or going full screen only if it's sensible to do so?
Thanks for any help you can give. Let me know if you need more info or if the above isn't clear.
Mark
Is there a better way of testing whether going full-screen will lose the menu button?
No. The Viewsonic device in question does not qualify for the Android Market, AFAIK, and all bets are off in terms of compatibility for devices that fail to meet the requirements for the Market.

Categories

Resources