How to use a PC webcam as the emulator's camera - android

I'm developing a qr code reader application. How can I use my webcam as a camera to scan the qr code in the emulator ?
my SDK version is 4.3. I checked it out in developer.android site and they said that you have to select webcam0 as a back camera. I tried but it didn't work, and shows "unfortunately your app has been stopped".

Follow the below steps in Eclipse.
Goto -> AVD Manager
Create/Edit the AVD.
Hardware > New:
Configures camera facing back
Click on the property value and choose = "webcam0".
Once done all the above the webcam should be connected. If it doesnt
then you need to check your WebCam drivers.
check this answer for the image & a further link:
Here

Use the Camera tab in Extended controls to add or modify Scene images. There are two image locations, one on the wall and one on the table.
To view these image locations in the scene, launch your emulator, then move the camera to the dining room area through the door behind the camera’s starting position.
https://developers.google.com/ar/develop/java/emulator#add_augmented_images_to_the_scene
Sample image from my emulator:

The Android Studio virtual emulator now has virtual scene images under the camera section of the extended controls. With this you add any image to be scanned by the virtual emulator. Had a little trouble finding it though as you have to navigate into a different room to see it in the virtual scene.
Can't see virtual scene images in emulator camera app

Have you set front/Back cameras when you created the emulator like this in your AVD manager

Related

How to emulate process of making photo in virtual box android emulator like on regular phone (Android x86)

Is it possible to do this? I need to open camera in emulator and make a photo, but by default emulator dont have access to real camera when i opened it there just a black empty interface.
I need to making photo like if i make this photo in real time on regular phone.
Put ready photo tap photo button and from the side it seems like im making photo normally.
Yes! It is possible to emulate both the front and back of the phone's cameras.
If you are using Android Studio, you can head over to AVD Manager, press the pencil (known as an edit) button beside the phone emulator on the left side, click Show Advanced Settings, and you should see the Camera section (the image of the camera section), and choose the webcam option, or whatever that is relevant to your case.

How to record screen with Android Studio

I connect my phone to Android Studio and code. I want to record my phone screen. I saw this but that button is disabled in my Android Studio. I can capture screens but can't record. Can someone help me with this?
UPDATE
This is how it is there in my Android studio. The button is disabled
Now you can also record video from Android emulator to follow below option:
Select more option
Then select Record screen option.
Check below screenshot:
Go to your menu
View -> Tool Windows -> Android
You will find the record icon at the bottom left corner.
If you are using an AVD, make sure "Use host GPU" is disabled.
To take a video recording of your app:
Start your app as described in Run your App in Debug Mode.
Click Android to open the Android DDMS tool window.
Click Screen Record on the left side of the Android DDMS tool window.
Click Start Recording.
Interact with your app.
Click Stop Recording.
Enter a file name for the recording and click OK.
Source: https://developer.android.com/tools/debugging/ddms.html
Maybe your device does not support the screen recorder, there are many devices which does not support screen recorder thus this is device issue. If you want to record your app screen then simply run the app on android emulator or on genymotion and start your desktop screen recorder and adjust the desktop screen to fit emulator. There are many screen recorder for PC but i prefer cam studio 8.
Thanks
In newer versions of Android Studio it requires an external Android phone to record screen from preferably with a resolution of at least 720p. Since the internal runs on the virtual memory it can't be recorded and is therefore disabled as it can't both record and run emulator at same time.
I'm running Android Studio 2.3.2 which is the latest and the one I experienced this on. But when I closed the emulator and connected my HTC One M9 it automatically enabled recording button to record the phone instead of the emulated device.
Check the images below and the difference between them in the red circles:
First image, emulated device on the computer:
Second image, personal device connected to computer:
You can record videos from the command line into an .mp4 file:
adb shell screenrecord /sdcard/video.mp4
When you are done recording, press Ctrl+C.
Then you can copy the file to your computer (current folder)
adb pull /sdcard/video.mp4
If you want you can delete the file from the sdcard
adb shell rm /sdcard/video.mp4
Android SDK Emulators don't support recording:
https://code.google.com/p/android/issues/detail?id=61682
The screenrecord command is simply missing:
i:\>adb -e shell
root#generic_x86_64:/ # screenrecord
/system/bin/sh: screenrecord: not found
127|root#generic_x86_64:/ #
On Windows I suggest using the Fraps generic screen capture tool as an alternative. It's an awesome tool with too many years of history to count. I'm not affiliated with them, I just used it "back in the day" when I was gaming a lot. On the Movies tab add a Video Capture Hotkey and use that to start/stop the recording. The FPS counter will be red while recording.
Maybe you should just change a phone,like this:
When using HUAWEI,the screen record is disabled:
But when changing to Nubia, it works!
I had the same problem. It was solved when I didn't run but debugged de app.
Once you have debugged your app, the icon will be enabled even if you just run your app without debugging.
I guess this has to be done for each app you develop, as it must be a debugging feature or something like that.
*Note that at this image I'm using Android Studio post 2.0, but when this problem happened to me I was using pre 2.0, so that should not matter.
Open Android emilator,
Click to right sidebar more button "..."
Open new window, Record Screen and start record
It's OK
https://developer.android.com/studio/run/emulator.html
for those who never found screen recorder button or screenshot button. here you go
First, make sure you have LogCat open (Press F6, at least on OSx).
Then you might find that you still don't see any record button. Just hover on the tiny "overflow" arrow seen in the image below.
You should now see the record button, indicated in the image below.
Congratulations, if your device supports screen recording, just click the button and up will pop a dialog asking you to input resolution and bitrate
Record video from Android emulator
As a workaround for MacOS users
Open QuickTime Player -> File -> New Screen Recording
If you have a real device run it in debug mode and then go to the Logcat view there will be a screen recording button on the left.
stupid mistake I made was I had two android devices connected.
And I was recording off the locked one so my video was always 18mb and black screen and wouldnt play in quicktime.
On Android Studio Arctic Fox They have moved this functionality to the logcat
https://developer.android.com/studio/debug/am-video
In case of emulator I experienced that you should install DirectX End-User Runtime
Installed it for another application and luckily also Android Sceer Record is working fine and isn't greyed out!
Hope this help some other people

How to record android screen with Android Studio?

I've installed Android Studio in the Applications folder on my Mac (I think the sdk is then in the package content), but now I want to record my screen for a demonstration video of an app with AShot.jar, and I have to give up the path to the SDK. When I give the path I think is right, it says the path Applications/Android\ Studio.app/sdk is not valid.
What to do?
Are there other ways to record your android screen?
Connect your Device with your pc via usb.
Open android studio.Ensure that device is connected with adb.
Start click Screen Recording.
Screen Record can record the device display for a maximum of 3 minutes.
Note:
The Screen Record Works with Real Android Device and some Emulators.
If the button is in grey and un-clickable means that device not supports video capture.
The Screenshots from my system:
For those of us who need a "Complete Idiot's Guide" in order to find the elusive "Screen Record" button, here it is:
First, make sure you have LogCat open (Press F6, at least on OSx).
Then you might find that you still don't see any record button. Just hover on the tiny "overflow" arrow seen in the image below.
You should now see the record button, indicated in the image below.
Congratulations, if your device supports screen recording, just click the button and up will pop a dialog asking you to input resolution and bitrate (since this is an "Idiot's Guide", just skip those and click "Start Recording"!).
If you are using Android 4.4 or higher you can use adb:
http://developer.android.com/tools/help/adb.html#screenrecord
It can be found in the platform-tools folder under your sdk install folder.
This point may be helpful for some one else
All device do not support screen video recording with android studio. In this regard you can use emulator.

barcode scanning in android emulator

I'm trying to do barcode scanning using Android emulator. Could anyone
please tell me what steps to follow to do a simple barcode scanning on
the emulator?
Thank for any help,
Yes, you can set the image of wall and table from virtual scene on emulator config.config android emulator
In Android Studio,go to AVD Manager
Choose a device then Click "Edit this device" ->
Click Show Advanced Settings
At camera, select Front: Emulate, Back: VirtualScene.
Then Run App, Click ... - (icon More) at toolbar of device
Click icon camera
Click folder and choose image QR, then you can scale it
Close panel, an continue run app.
When you go to Scan QR Screen, please use ALT + QWEASD to move and control
Then image will be scan
You can enable the cam on android emulator, and so use a barcode scanner on it.
To do so, you have to set the emulator property "configures camera facing back" (or front) to "yes" or "webcam0".
source : http://viralpatel.net/blogs/enable-camera-in-android-emulator/
Yes it is possible.
you can use the camera of your laptop as the AVD's front or back camera
You can't use barcode scanner on emulator because for scanning you need a camera..so if possible then use mobile device for it..
It is possible if you have a camera on your pc/laptop.
In Android Studio:
Open Device Manager;
Select the emulator device and click on Edit icon button;
On Camera section you can find Front and Back;
Select Webcam (In my case on mackbook I have Webcam0) in both cases ;
Save settings and close emulator;
On Device Manager select the emulator device -> 3 dots -> Cold Boot Now;
Now when you open camera activity/fragment/compose_view on your emulator, android studio may requires the camera permission on your mac/windows.

How to get screenshot with Android phone bezel in Eclipse AVD?

I have an Android presentation coming up and would like to get some screenshots of my application. Thing is, I'd like to have a screenshot of the phone with the app running on it.
I could use a camera and take a pic of a droid phone+app, but seems to me the AVD used to run inside a picture of the Nexus phone. Just wondering if it's an Eclipse config option somewhere?
Thanks!
Try using image editing software to superimpose the screenshot into an image of the phone. That's what the designers I work with do when they need to make PR screenshots.
run the DDMS from the location where ever you have installed the Android and then chose Device menu and screen capture
just do alt+printscreen from keyboard keep in mind AVD is focused you will get screen shot of AVD..

Categories

Resources