As the title stated, I want to design simple application without interaction from the user. After installation it will block the camera. then start a timer to release it after some time.
I tried 2 options: device manager using set camera disabled method but I could not run the project because of some errors in the manifast.
now I'm trying just to create a camera object to reserve the camera from other applications. but still the native camera app was able to start the camera.
My question: is my method correct? or there are much simpler ways to do it.
device manager using set camera disabled method but I could not run the project because of some errors in the manifast.
Perhaps you should consider asking a separate Stack Overflow question where you explain what you tried and what specific problems you encountered. If by "device manager" you mean the device administration APIs, this is the proper way of implementing what you want.
is my method correct?
No.
Related
I need to measure the App Launch time. What I am thinking of is to have a static variable of the current time on Application onCreate and in the 1st fragment of the app I subtract this variable onActivityCreated. But I do not think this is the best practice. Is there a lib or a call that provide such result?. Appreciated your kind help.
You can use a tool such as TraceView to help debug the application and profile the performance. It's basically a a graphical viewer for your execution logs.
To start the Traceview tool:
Start the Android Device Monitor.
In the Android Device Monitor tool bar, click DDMS and select a process.
Click the Start Method Profiling icon to start method profiling.
After the profiling is complete, click the Stop Method Profiling icon to display the traceview.
There is more information on how to use TraceView here:
http://developer.android.com/tools/debugging/debugging-tracing.html
I'm working on UI automation tests for an Android app. I need to save off a screenshot of the app as it appears during various steps of the test for later analysis by test engineers.
The usual way to do this in Android is to get the Window, then get the DecorView, then call onDraw with a Canvas backed by a Bitmap and save the Bitmap. This doesn't work when a Dialog is showing on top of an Activity, however. The Dialog and Activity each have their own separate DecorView.
Is there any way to programatically take a screenshot of the entire app with all windows composited? Unfortunately, the device is not rooted and the app does not have signature permissions, so this answer in another thread does not apply:
https://stackoverflow.com/a/13837910/244521
For phone devices: This article shares some tips that might help. However, on ICS and above, you may need to use Home + Power, not Volume Down + Power, as the article says.
For automated tests, perhaps AutomatedScreenshots will help
I know this question is ask number of times but wait i am asking something different.
I follow this post and able to take screen shot. but is it possible to take screen shot when my application is closed.
Supposed i set timer like after 1 hour and i close my app. Then exactly after 1 hour device need to take a screen shot whatever on a screen.
Is this possible with Background Services?
I already follow code and also did some research but is this possible?
Is it necessary to root device to take screenshot.
Please give me any hint or reference.
Thanks in advance.
Try using : call the methods in this library from service.
http://code.google.com/p/android-screenshot-library/
Android Screenshot Library (ASL) enables to programmatically capture screenshots from Android devices without requirement of having root access privileges. Instead, ASL utilizes a native service running in the background, started via the Android Debug Bridge (ADB) once per device boot.
DeveloperGuide
UPDATE:
The method mentioned in your reference will not work in that case, as it reads the view that are drawn and in application context. where as if application is closed then you cant get that context.( at-least on non rooted phone).
On rooted device you can read complete frame-buffer so no need to worry about the application context.
I did tried to use the ASL once and it worked out good for me.
What I want to do is be able to take a picture with my app and return that picture to an activity...either to modify it or simply view it. My possible problem or question is: How do I know this will work on all versions of Android phones? I know some phones run different versions/flavors of Android. Some will also have a manufacturers software overlayed on it. Is it possible to write one method that handles all phones and their cameras?
Use the ACTION_IMAGE_CAPTURE intent. See this for more info.
I want to create a security application in which I want to disable the mobile camera when some event occurs.
As the user, I can disable the camera by going into settings. Can we do same thing in using code?
You could write code that opens all cameras and doesn't release them. As long as your app is running the camera won't be available to other apps, including the default camera picture taking thingamajig.
If you still need a right solution then use DevicePolicyManager.setCameraDisabled().