mediaprojection : Black screen in some cases - android

Using "mediaprojection" I was able to capture the current screen from a background service.
The sdk api is 25, Android 7.1.2, and I checked it with an emulator running with BlueStacks without rooting and my mobile phone without rooting.
But when I test it with BlueStacks and another emulator, Nox, I get a black screen.
The same code and only in the Knox emulator without rooting the same code is black screened in the result.
Could the results be different depending on the emulator?
Do you have a "mediaprojection" application running in a background service to test this case?

I have the same problem before but I noticed that bluestacks doesn't allow the use of applications with mediaprojection you can't try in your own device if you want to test apps that can take screenshots or similar situations

Related

Android app built using Xamarin does not show up on emulator

I have written a simple login page using xamarin forms. When I try to deploy it on emulator, the emulator opens but my app is not visible.
1) Does it take time for the app to be deployed? Or would it appear on start up?
2) Should warnings be considered? I have no errors though.
Most Android emulated devices are slow. I have found that some of them simply won't render an app. This is not an indication that the physical device, which you are trying to emulate, won't work however. Try testing what works in an emulator and then creating a copy of what works in the device manager. Then make slight changes that are closer to the target device in the copy. Deploy every time to ensure that it is working. This process takes patience. If you are fortunate enough to have the physical device, debug through the USB connection.

Testing my app on different devices

I have developed an Android app and it's ready for launching , now i wanted to test it on different possible devices ,but unfortunately i can't afford all the devices physically and I can't download emulators for all the Android devices , is there any way to test my app in different Android devices and see how they work on that device's
Thanks for your time and help.
Use Genymotion, it is very light and clean, better than AVD (Android Virtual Device)
it's the android studio should be able to test almost every screen size you can also try testing on android emulators like bluestacks and others they'll help

Android Emulator camera hangs after sometime

I am developing an android camera app. Whenever i open the app the camera opens normally then after a few seconds most of the times it hangs and ultimately the emulator shows not responding after a while. Very rarely it operates normally when i open the app. Not only my custom camera app but i tested the default emulator camera, it also hangs after a while when it is opened. I don't know what is happening wrong. On real devices my camera works fine. So the issue is not with the app but the camera of my emulator.
It is a bug with certain versions of the emulator. For example, camera app hangs on emulator version 29.3.2.0 (build_id 6083285) regardless of the whether it's emulated or set to Webcam0, but works fine on 29.2.1.0 (build_id 5889189).
I have the same issue but only on one of my laptops. It seems someting is connected with computer graphic card.
Try to change paramather Automatic with Software-GLES 2.0 in AVD manager-emulated perfromance. IT's slower but it works.

Emulate led flashlight in android emulator?

Is there a way to emulate led flashlight in android emulator? I've already tried to see what options are available when setting up the AVD but there was only an emulator for camera!
The emulator can't do that. You need a device. It's also good to develop on a device since the emulator can sometimes behave differently.
If you just want to test different states of the led, then you can create a small view and change the color of that. You need a device if you want to see the led actually working.
You need an actual device with flashlight to test your flashlight. There is no way to test flashlight in emulator until emulator provides you with led service like in 'geneymotion' you can use your laptops camera as your emulator's camera.

Is there any way to launch a Genymotion emulator with the screen already unlocked?

Our team recently setup Genymotion for a Jenkins instance using the instructions here. Everything is working awesome except for functional tests, which use Robotium.
It seems that the instrumentation can't figure out how to unlock the device, which means that it is unable to find the necessary UI elements for our functional tests, causing them all to fail.
I've tried taking a snapshot of an unlocked device, restoring that snapshot, and then launching the emulator with Genymotion. However, when I do that, Genymotion gives me an error on start saying that the device is in an incompatible state and then the Jenkins run fails.
So, I'm wondering is there any way to either programatically unlock the screen or launch a Genymotion emulator such that the screen is already unlocked?
EDIT: The tests are targeting API level 10 phones.
I discovered the solution was to add this line to our Jenkins pre-execute script.
adb shell input keyevent 82
This simulates a press of the menu key, which removes the lock screen.
Unless you need lock to show up, simply disable screen lock in emulate device's settings. Setting is persistent.
EDIT
There are tools like No Lock (Google Play link) that may be helpful in your case. I checked using Genymotion with API10 image (Nexus S) and it does the trick

Categories

Resources