Easiest way how to take a screenshot using OverlayService Button - android

Is it possible to make a screenshot of a phone screen beyond the Activity background?
I want to realize an Overlay button which will make a screenshots of work of other applications on phone.
The first try in this direction was performed in this discussion Taking screenshot using OverlayService Button, but the problem wasn't solved.

Related

How to programmatically take a screenshot on mobile(android) any where from service(background)?

Is it possible to programmatically take a screenshot of a mobile screen that is currently displaying? I want my app to take a screenshot of another screen after some time from a background service. what I have done already is I am getting the screenshot from the service but it is taking the screenshot of my app activity in which code is written but I want to take a screenshot every 5 mint no matter what screen is on appearing on the mobile from the background screen.
it is possible then help me out, please?
Maybe you can create only a receiver ACTION_TIME_TICK. If you declare it in AndroidManifest, this works when app closed also. However this works every minute and you have to control modulus 5 in onReceive and capture screenshot.

Activity Methods don't work when App is unfocused

I'm running into an issue and I would appreciate some guidance. I'm writing a small Android program in Android Studio that uses MediaProjection to grab a screenshot of the whole screen and then I want to pass that screenshot as a Bitmap to my System Overlay (based on the chatheads example). When the MediaProjection runs and the Imagereader creates the bitmaps, I'm passing the bitmap into a class global variable so I can pass it into my System Overlay service and display it. The problem I'm running into is if I "tab out" to a different app, my methods stop working from the MainActivity. When my app is in focus, everything works well, when a different app is focused, the system overlay contracts and expands like it should, but the screenshots are not being taken anymore. My understand is its because my app becomes "asleep" since it's not in focus. Could anyone recommend a solution? Can I momentarily awake my mainActivity so it can take a screenshot? Can I keep my activity from falling asleep on app switch? Can I bring focus to my app, take the screenshot and then switch focus to the previous app? Any other ways?
My code can be found here: https://github.com/asheron21/FacebookLikeChathead
MainActivity:https://github.com/asheron21/FacebookLikeChathead/blob/master/app/src/main/java/com/example/chatheads/MainActivity.java
Service: https://github.com/asheron21/FacebookLikeChathead/blob/master/app/src/main/java/com/example/chatheads/ChatHeadService.java
Global Variables:https://github.com/asheron21/FacebookLikeChathead/blob/master/app/src/main/java/com/example/chatheads/Globals.java
Thanks!

showing image on top of running phone

how is it possible to show an image ontop of a running activity while still being able to control the background?
in case some ppl say it is not possible, check this app out:
https://play.google.com/store/apps/details?id=com.myboyfriendisageek.stickit&hl=en
is there a way to open a transparent activity but still being able to control the previous activity?
ive also tried using a toast, but that is capped by a timer, and i have not been able to find a way to control it.

How to create an overlay canvas with propagation of touch events to the home screen?

For the life of me, I cannot figure out anything about this topic. Maybe I'm just not using the correct keywords while searching.
What I'm trying to do is create an overlay transparent canvas which will basically pass on all touch events to the Android home screen, in effect, making the phone completely usable.
If I'm not making sense, please have a look at the "Transparent Screen" application on the Android Market. That is exactly what I want to do. The camera preview screen is always on top while the phone can be used normally. How can I achieve this?
Got it! Just use this in the activity:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
It creates a click-through activity.

Any way to hide Android home screen icons to show Live Wallpaper?

As Android live wallpapers are becoming more prevalent, and developers are doing more with them, a question coming up more and more is how to hide the home screen icons temporarily while the user interacts with the wallpaper.
For this to work, the icons would have to be removed temporarily – not just made invisible, since a tap on an invisible icon would still run the app.
Also, it would be ideal to have a universal solution that works across customs launchers, not just the Android stock launcher.
This question was already asked on StackOverflow, and the answer was that you cannot do this. But this is clearly not correct, as there are at least two programs on Android Market that do exactly this: Show Off (Your Live Wallpaper) and The Cleaner (Show Wallpaper)
Is there a way to hide Android home screen icons, and then later put them back in place?
You can launch an activty which backgroung will be your live walpaper, and finish the activty upon touch... Just a thought...
Edit:
1st comment answer:
Preventing the delay:
You should be more "gentle" in the onCreate() method...
Try creating the minimum as possible in the onCreate(), like, just displaying the basic background...
in the end of the onCreate function, set an alarm (i.e. by AlarmManager) to call some BroadcastReceiver/Activity after half a second or so (with AlarmManager) to set the rest of the live wallpaper graphics... that way you don't have to worry about the delay.
This would have to be a completely new launcher. This is not possible without this I don't think. Sorry. However; to be absolutely sure though you'd have to look at the Launcher2 package in the android source and look through files like Homescreen.java. I'll look into it later on 2.3.3 for you and see what I find.
Try using the zoom gesture as you would to zoom in on a web page (reverse pinch). And you guessed it, the opposite makes everything come back.

Categories

Resources