Change Android Emulator resolution When using Xamarin - xamarin

I'm using the standard Android emulator that comes with Visual Studio 2019 with a Xamarin project but the resolution is ridiculously low as you can see:
I'm trying to build a simple login screen and my screen has a small logo, the username and password field and a reset password link and the screen is pretty much full. I should have a tonne of space but it's not the case.
Is there anyway to increase this as I was on my own phone for example (Samsung S8+)?
I found a couple of article mentioning this should be done when creating the virtual image, but there is no mention of what properties should be set to?
Thanks.
Update-1
I've just added a few properties I noticed were missing from the emulator property list but it made no difference:
hw.lcd.density : 560
hw.lcd.height : 2560
hw.lcd.width : 1440
hw.ramSize : 1024

I'm not sure if you are trying to edit the properties on an existing image, which I don't know if it would work. Have you tried creating a new image?
In the android device manager (tools > Android > Android Device Manager), click on new to create a new image. Set the base device to generic Phone Xh-DPI 4.7". This populates the fields density/height/width with 320/720/1280. Adjust as needed and hit create. Once created, set this as your deploy target.

Related

Visual Studio 2019 Xamarin Forms android emulator failing with message System UI isn't responding

Getting an error message, 'System UI isn't responding.' and it gives me the options 'Close app' or 'Wait' when debugging Xamarin.Forms. This is on the emulator that launches. I have set the memory at 512 and the resolution at 800x600 as some have suggested in other threads. I also did a 'factory reset.' Nothing has helped so far.
Are there any other options that may get me past this? I just purchased a Xamarin class from Udemy and can't even get past the first few videos.
I should mention that I do not think I am short on resources. I have two 500 GB SSD drives and the following memory and processor specs.
First of all, please make sure your have enabled the Hardware acceleration for emulator, https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?pivots=windows
If you enabled it, please delete this emulator, create a emulator like this screenshot.
https://imgur.com/a/ZyBakKc
I resolved this issue by going to Tools in Visual Studio. Tools > Android > Android Device Manager > select and edit property (hw.gpu.mode) of emulator to mesa

Xamarin Device Manager only shows Google play images in device manager screen

I have observed the following in the new Xamarin Device Manager for VS 2017 (15.6.4).
If i try to create a new device i can only choose between system images for sdk versions where the Google Play image has been installed.
But if i edit the device profile that was the default and created with the google api's not the play ones, i can without any issue choose all the system images installed. So it seems the Xamarin Device manager only looks for Google play system images and not for the google apis ones.
So a workaorund for now would be to copy the "existing" 7.1 device profile and edit that.
Can someone confirm this issue ?
Image shows that only Android 7.0 and 8.0 can be selected and are installed
SDk Manager shows that several system images are installed not just the ones we are able to choose in the create new dialog.
If editing device profile that was based on Google APIs not Play all images can be used
You can switch Google Play/Google APIs/Default images via tag.id property in the editor.

ARCore unity debugging

For example I try to print out to the console and it doesn't, my script is attached to my main camera so we can rule that out and yes the script is active also, any help will be appreciated, right now what I am working on is to click on a certain part of my GameObject in AR and while my phone is connected to the computer I want to see the name of the certain part I clicked on in the console.
When you run the app on and Android device the log does not go to the Unity editor console. In order to see it you need to open Android Studio and then use the Logcat tab to see the device log.
Alternatively, you can run logcat from the command line
adb logcat.
More information: https://developer.android.com/studio/command-line/logcat.html
I have worked with ARCore and had the same frustating experience when it comes to debugging.
If you just want console prints, then use Log viewer which can catch and show them on Android too. (https://assetstore.unity.com/packages/tools/log-viewer-12047)
However, because I wanted more control and the ability to test and debug my game logic right inside the editor (without deploying to the phone all the time), I wrote a little plugin that allows me to do just that. This plugin simulates the operation of ARCore inside Unity editor. You can just hit play and ARCore will be simulated for you, so you can freely develop and debug your game logic. Moreover, you can then just build and deploy the project without changing anything, and ARCore will work like normal on your phone.
Using it is very similar to native ARCore, so you will not have much difficulty getting into it. It does not cover ALL features of ARCore yet, but it covers the basics. You can still use native ARCore for the rest.
You can find it here: https://github.com/VR-House/Eazy-ARCore-Interface
In current versions of Unity you can output logs from connected devices to Unity Editor. To do this, build your project in Development Mode and connect the Console to your device.
But I would recommend a more advanced way of testing AR in Editor with a plugin I wrote. I wrote it for my project and decided to make it into a plugin so everyone else can benefit from it.
AR Foundation Editor Remote plugin:
https://forum.unity.com/threads/ar-foundation-editor-remote-test-and-debug-your-ar-project-in-the-editor.898433/
I use debugging like this in C# script:
Debug.Log("Debug message and image name "+Image.Name);
To see this real time, I use Android Device Monitor (it's in Android's sdk folder, usually \Users\AppData\Local\Android\sdk\tools\monitor.bat. If device is connected, it appears on the devices list and it can be selected.
Or if I want to see the debug log in device, I put these lines in script:
private void OnGUI()
{
GUIStyle style = new GUIStyle();
style.fontSize = 50;
GUI.Box(new Rect(350, 0, 500, 500), Image.Name, style);
}
The Rect(350,0 is the position, 500,500 is the width and height of rectangle.

How to run DayDream Controller from Unity Editor?

I am developing a DayDream app and working with a Pixel XL and real DayDream Controller (on a MacBook Pro). I would really like to be able to test with the DayDream Controller when running the app from Unity Editor. Currently, I am forced to make a build for every little change and its killing me (slow).
I believe that I can do this by connecting my Pixel XL via USB cable to my Mac and then using adb to configure it. But, all attempts have failed so far.
I don't know about real Daydream Controller, but you can try using your phone as DayDream Controller Emulator.
As it said here, you should download emulator APK from here, install it and run on phone connected to WiFi.
In your Unity project find GvrControllerMain and change Emulator Connection Mode to Wi-Fi. Also find Assets/GoogleVR/Scripts/Controller/Internal/Emulator/EmulatorConfig.cs and change line to IP address displayed on daydream controller emulator app on phone.
// IP address of the phone, when connected to the PC via WiFi.
public static readonly string WIFI_SERVER_IP = "192.168.0.78";//"192.168.43.1";
Click "Play" in Unity, it should work.
In addition to diesersamat's answer, I would like to add two things:
You could run the controller emulator via USB by choosing "USB" from the Emulator Connection property of the GvrController script that is attached to the GvrControllerMain component. For the USB connection to be made, you have to make sure that %AndroidSDKHome%/platform-tools is added to your PATH variable.
You could use the real controller via Emulator: Open the Controller Emulator app --> open the Emulator's overflow menu --> select Switch to Real Controller. For this to work, the phone that runs the emulator has to be Daydream ready. I usually use the same phone that I use for Daydream VR as a controller emulator.
At Google I/O 2017, the Daydream team announced instant-preview which supports a "headless" controller-only mode.
The repo is on github: https://github.com/googlevr/gvr-instant-preview
The moment in the Daydream keynote where it is mentioned is here: https://youtu.be/tto90e-DfeM?t=26m45s
I had the same problem trying to get the emulator to work. The solution for me was to set up the player settings to android and click the VR supported tab with the daydream SDK selected in the VR SDKs dropdown BEFORE importing any daydream/google VR packages.
Took a lot of trial and error for me to figure that out. Hope that helps.

Windows Mobile Device Emulator - Create Device with custom resolution

I am currently developing an application for a windows ce 6.0 device with Visual Studio 2008 and the Compact Framework 3.5.
The device itself has a resolution of 800x480 pixels.
Currently I am developing the app on the device itself which works great.
However on the long run I can't ensure I have always access to the hardware (like today, I am working from home office) and I want to be able to use the device emulator.
I am usin a "Windows Mobile 5.0 R2" image which ships with the Microsoft Device emulator.
Most of my forms are independent from the resolution and work out of the box on the 240x320px screen of the emulator.
However, there is one form that has a fixed resolution of 800x480 but I can't figure out how to modify or create an emulator (windows mobile or windows ce, it doesn't matter) with a predefined resolution.
Any help would be appreciated
Open up Visual Studio, ensure the emulator is not running and then follow this "path"
Menu Tools->Options
Open Options Tree to DeviceTools -> Devices
Select your Emulator Device from the Devices list
Click 'Save As' and give it a name (e.g. NewRes)
Select your newly created device in the list
Click 'Properties'
Click 'Emulator Options'
Select the 'Display' tab
Change the Video settings to your desired resolution
Click 'OK' 3 times
Change your target device in your project to the new device
Deploy
Enjoy
You can customizing device emulator machine configuration, by editing the associated decfg files.
To create decfg file in device emulator manager:
Select desired device configuration from Datastore (for example Windows Mobile 5.0 Pocket PC Emulator).
Connect to it (Right Click - Connect)
When device started, save machine configuration (Right Click - Save-As)
Give any name to the file (for example test.decfg), and save at the default location ("%USERPROFILE%\Documents\My Device Emulators")
At this point stop the emulator (Right click - Shutdown). Now you can edit the saved decfg file, contained all the emulated device parameters (memory, resolution, etc.).
You can start the new custom emulator from the Device Emulator Manager under the My Device Emulators section (see screen bellow).
Example decfg file content:
<?xml version="1.0"?>
<DeviceEmulator xmlns="http://schemas.microsoft.com/DeviceEmulator/2006/01/DeCfg">
<Board>
<CpuCore Reconfigurable="false">ARMv4</CpuCore>
<CpuOptions Reconfigurable="false">TDI</CpuOptions>
<VFP Reconfigurable="false">false</VFP>
<OSImage Reconfigurable="false" Address="0">C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\DeviceEmulation\0409\PPC_USA.bin</OSImage>
<MemSize Reconfigurable="false">128</MemSize>
</Board>
<Emulator>
<DefaultSave Reconfigurable="false">true</DefaultSave>
<FuncKey Reconfigurable="true">193</FuncKey>
<HostKey Reconfigurable="true">Right-Alt</HostKey>
<Language Reconfigurable="false">1033</Language>
<VMID Reconfigurable="false">{812DA9C7-D9F2-4C57-85CD-29A7ED08C20B}</VMID>
<Video Reconfigurable="false" Width="400" Height="234" BitsPerPixel="16"/>
</Emulator>
<Peripherals>
<SerialPort Reconfigurable="true" UARTNumber="0">none</SerialPort>
<SerialPort Reconfigurable="true" UARTNumber="1">none</SerialPort>
<SerialPort Reconfigurable="true" UARTNumber="2">none</SerialPort>
</Peripherals>
<Platform>Windows Mobile 5.0 Pocket PC SDK</Platform>
</DeviceEmulator>

Resources