Take ScreenShot of a current Screen using a background service in android - android

I need to write a service that will take screenshots of the current screen at specific intervals.After studying I found that there are two ways to do so :
By rooting the device and access system level privileges to read framebuffer and convert it into a bitmap
2.Use ASL library to take screenshots
Since I don't want to root the device,I decided to go with ASL but whenever I run the demo code,I get native service not found.Please suggest me the steps to implement ASL and make the code to work.

In order for ASL to work, you have to connect to a PC once after every boot, and start the native service via ADB.
I guess you missed that, thus the service is not found.
You can find more on that here: http://code.google.com/p/android-screenshot-library/wiki/UserGuide

Related

How can my Android app get method tracing of another process/app on a phone that has enabled developer options?

I would like to write an Android app (not a PC program) that has a subset features of Android Device Monitor (ADM), ie. select a process and trace its method calls, with detailed information (all the information that ADM can get, like stack trace and time), while the phone is not connected to any computer nor does it have any network access.
I've searched into android.os.Debug.startMethodTracing*, but it seems can only trace current process and the result can only be written into a file (I need the info in memory).
Digging its implementation, I found dalvik.system.VMDebug.startMethodTracing*, but it seems cannot be used by apps and I didn't find a way to specify pids, neither. Looks like it's calling JNI functions, but I didn't find the implementation.
Maybe I can get the information by lower level way by using Linux perf events (perf_event_open(2)). But before doing that, I would like to know if such kind of feature possible to implement purely in Java (maybe by talking to some "system manager" process or "debugging server" process, or by calling some CLI tools then get its stdout)?
These capabilities can only be accessed by the shell user (the user that adb runs as), or the root user of course. By design, a normal android application cannot access these features, because this would completely break the application sandbox that is the basis of the application security model in Android.

Android: Interact with another app?

I'm looking to build an app that will restart my device at a specified time, then open up a couple 3rd party apps in sequence and run their feature/s.
For example: I would like to automatically restart my phone at 5am. Then have it open an antivirus app of my choice and run the scan. Then close that app and open up another app and run it's cleaner function.
I have experience coding, but I'm just starting to take a peak into android app development. So, I was wondering if this is something feasible to do.
Any advice would be appreciated!
I am not sure about the starting phone at the desired time, but I am sure you can start applications on boot using "init". Linux systems support that, and android does as well. But it completely depends on your kernel.
Read here about init.d.
Check if your phone's kernel supports init.d. Check here if your phone doesn't have init.d support.
Check Here for running a script at boot. It is quite useful for custom scripts.
Check Here for running scripts/application the application at boot
Create a script according to your needs and I think you would be able to achieve what you are looking for. <- Custom Rules
I would have commented but apparently I can not since I am new here.
I hope I was of some help. Will look into the android starting part and get back to you.
Cheers.

android stopping another application

I have been trying to do some research for this but I did not find the one I was looking for.
So, what I would like my application to do, is simply stop another application.
If I would use .bat and .exe examples like I do with my computer, I would like stop .bat tho stop notepad.exe.
It do not care will it stay as a background app or no.
You can only kill your own applications, as each app runs sandboxed as a separate Linux user.
If this is no problem for your use case, killBackgroundProcesses should do what you're looking for. An additional requirement for this is the KILL_BACKGROUND_PROCESSES permission.

android taking screenshots programmaticaly Android Screenshot Library issue

What I want to achieve is to capture a current foreground activity and save to bitmap file. I need to handle taking that screenshot in a background service. I have run through many ideas, tutorials that mainly uses invoking getWindow() method and enabling cache. However that approach is useless for me - it is impossible to get reference to the foreground running activity (isn't it?) - using ActivityManager I can get only the name & package of it.
I came across the ASL (https://code.google.com/p/android-screenshot-library/downloads/detail?name=asl-1.2.zip&can=2&q=) which uses "native service" which is available in compiled binary file. Library's wiki note states that you have to start the native "screenshot service" by ADB using pc.
My question is: could it be possible to start that service programmaticaly through java code, something like JNI (using NDK) does?
On a rooted device, you can start the service from Java with
Runtime.getRuntime().exec("su")
On custom system, you can start the service from /init.rc.
NDK will not help, anyway. Going C does not compromise the system permissions.

Android: Can a 3rd party application use AT commands to auto answer phone call...?

I need to develop an auto answering (GSM call) Android application.
I searched internet and learned that 3rd party applications do not have permission "android.permission.MODIFY_PHONE_STATE", because of which my application can not auto answer a call.
Then, I read about these AT commands. After reading different links I am still unsure about two things which I want to ask:
Can a 3rd party application use these AT commands to auto answer phone call...?
Does it require root access?
I think it needs root access (but I need to confirm), because on my unrooted phone I used command
"busybox microcom -t 5000 /dev/ttyGS0"
but I got
"busybox: permission denied"
( I tried to root the phone but because of some problem I am unable to root it.)
Since, I don't have any background of working with AT commands,So, before starting to write complete code for AT command, I need to confirm those above two points, to make sure that I 'm going in the right direction.
(I'm confused because, I wrote simple code to get the names of ports but program did not show any output (for my unrooted phone)...)

Categories

Resources