reboot android and take screenshot of current screen programmatically - java

Hello
Is there any way to reboot and take screenshot of android?
Settings.System isn't working for me.
Settings.System.putInt(context.getContentResolver(),android.provider.Settings.System.SCREEN_BRIGHTNESS, 200);
And, is there any way to take screenshot of current device screen, from application/service?
Thanks

Is there any way to reboot android programmatically?
Unless your app is signed by the system key, no.
Is there any way to take screenshot of current device screen, from application?
On most non rooted devices this isn't possible, but on some you may be able to parse the framebuffer if it is accessible (it isn't on the majority of devices).

Related

How to? Code Android App to Change user's LOCATION SETTING to OFF?

quick Android Development question on how to Code something!
I've searched for it, but the results are always messy, so I cant seem to find what I need.Any help is greatly appreciated..
Question:
How would I write the Code to: Turn the user's "Location" Setting to "OFF"..?
For example, in the same way that all of the "settings toggle buttons" homescreen widgets would do it, I assume - although i'm implementing it differently than that.I simply just need the raw code that turns LOCATION to OFF.
Also, what permissions would I need to add in my Manifest?
THANKS IN ADVANCE! :)
How would I write the Code to: Turn the user's "Location" Setting to "OFF"..?
You don't, except perhaps on rooted devices or as a system app (i.e., pre-installed by the manufacturer). Ordinary apps have no ability to change the user's location settings directly.
all of the "settings toggle buttons" homescreen widgets would do it
Only on rooted devices, or those that are supplied by the device manufacturer for their device.

Android / Java: Show GUI on "off-screen" (Always-On Display...)

I saw new Android devices coming out, that show things (clock etc.) once the display "turns off". That feature is called an Always-On Display, and since my Samsung Galaxy S6 edge already features an AMOLED screen, and a night-clock, I believe there is a way, to make it show something, when the display is "turned off". Is there a way using Java on Android, to display something, once display is meant to turn off? (Like just a normal GUI, I could do the rest then.)
Like, to tell your app, to show something, when the screen turns off, that is still visible somehow? (without root permissions)
That would be useful, thanks in advance.
UPDATE:
I found some apps on the Google Play Store, which seem do to, what I want (not that specialized though):
https://play.google.com/store/apps/details?id=com.thsoft.glance&hl=de
https://play.google.com/store/apps/details?id=com.orthur.always_on_display&hl=de
So it is definetely possible, I just need to know, how.
If you are not using root, then you can only use the Android APIs. Here is a list for example for the display: http://developer.android.com/reference/android/view/Display.html
I don't see anything there for the Ambient Display mode or Always-On.
Samsung provides APIs also for the features of it's phones here: http://developer.samsung.com/galaxy Here I can find the Look API that has something close to what you want, but for Edge.

Display image full screen through Android adb

I would like a way to display an image in full screen mode (without the home and status bar showing, images are same resolution as the device) on an Android device through ADB. The image could be either on the device itself of on the computer I am using to adb to the device, if that makes a difference (my first thought was that the image would be on the computer, but I've found some answers that leverage the device's storage and that would be fine).
What I would eventually like to do is set up a script that displays an image in full screen and iterates to the next file on a keypress.
This answer might be useful, showing how to display an image, but it doesn't show the image in full screen mode.
Possible ideas I have had, but don't exactly know how to implement:
Create an app that displays an image full screen and launch it with the required image as a parameter (not sure how to link the picture and the app from adb though).
Use the -n parameter seen in this post and specify an app that only displays images in full screen (could maybe make this app, but a pre-made solution would be easiest).
Any help/advice/guidance would be appreciated.
What that command is doing is starting an Activity that claims it can VIEW jpgs and launching it (passing it the file name via intent). It is not a built in android functionality, its launching an app. For you to display fullscreen as you wish, you need an app that does that, either by default or when some optional parameter is passed. There is no app like that you can 100% count on being installed. SO if you really need it, you'll need to write an app that does it. It should be a pretty trivial app at least- 1 image view and a fullscreen style is all you need.

How to programmatically check build.prop to verify model

I have an app I'm currently working on based on the HTC Open Sense SDK for android. However my biggest problem is keeping up with the device checker through the Google Play dev console to only allow certain devices to download the app. My biggest reason is that people will rate my app so low on the scale and say it sucks, but the problem is that they don't read the requirements - if you use an Lg G2 to try and launch an app made for an HTC ONE that requires Sense, it's going to crash.
So, how would i go about building a helper class that would check the device's model via build.prop (without needing root privileges) before opening/starting the main activity, and give the user a notification if the device was incapable of launching the app, and with devices that are capable of launching it, just continue the process of opening the app?

Capture android screen and create video programmatically

In Android/Java, Is there any code example to capture the screenshot of a computer with good frames per second programatically and create video?
I'd like a tutorial or full source code to do this. I'd like the program to work with and without the device having been "rooted".
There is app in the play store called Screencast Video Recorder that does this. But you need to ROOT the device for it to work, so I know it can be done.
What's the best way to capture android screenshot and create a video programmatically on a non-rooted device?
There is an app called Telecine that is open source that allows you to record screens - the code can be found at https://github.com/JakeWharton/Telecine. All credit is to Jake Wharton.
If you need an example, you can find one at Commonsware's github page - Mark Murphy has provided a sample app for both screen capture and screen recording using the MediaProjection APIs.
you can capture the screen via using DDMS as adb runs and has permission to the framebuffer:
follow this link for more details :
http://thetechjournal.com/electronics/android/how-to-capture-screenshots-and-record-video-on-android-device.xhtml
ALSO
check this links may be get some ideas about what you need :
http://answers.oreilly.com/topic/951-how-to-capture-video-of-the-screen-on-android/
http://www.mightypocket.com/2010/09/installing-android-screenshots-screen-capture-screen-cast-for-windows/
and check this project :
http://sourceforge.net/projects/ashot/
hope this help .
Check the following link
https://code.google.com/p/java-remote-control/
in this project the owner has created a java remote control i.e. he has captured the images from the remote computer and transfer to server and convert it to movies with different format all you need to understand what he has done and implement the same for all your needs. you can access the full source code with SVN client from the following URL
http://java-remote-control.googlecode.com/svn/trunk/
Also you can look for the Remote class in java which provides createScreenCapture method
As of Android 4.4, there is a screen recording feature accessible via adb.
http://developer.android.com/tools/help/adb.html#screenrecord
The screenrecord command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file, which you can then download and use as part of a video presentation. This utility is useful for developers who want to create promotional or training videos without using a separate recording device.
Try this application from the market
https://play.google.com/store/apps/details?id=com.ms.screencastfree
** Does not work on Galaxy Nexus or Tegra 2/3 yet **
EDIT 28/11/2014
Lollipop has been released and provides a new Screen recording API
http://developer.android.com/about/versions/android-5.0.html#UI
Screen capturing and sharing
Android 5.0 lets you add screen capturing and screen sharing
capabilities to your app with the new android.media.projection APIs.
This functionality is useful, for example, if you want to enable
screen sharing in a video conferencing app.
The new createVirtualDisplay() method allows your app to capture the
contents of the main screen (the default display) into a Surface
object, which your app can then send across the network. The API only
allows capturing non-secure screen content, and not system audio. To
begin screen capturing, your app must first request the user’s
permission by launching a screen capture dialog using an Intent
obtained through the createScreenCaptureIntent() method.
For an example of how to use the new APIs, see the MediaProjectionDemo
class in the sample project.

Categories