In a .NET MAUI project, I have this line:
var result = await client.GetStringAsync(https://localhost:7239/products/);
When compiled to a Windows app, it works as intended; when compiled to an Android app, I get this error: "Failed to connect to localhost/127.0.0.1:7239".
Things I have already thought about checking:
<uses-permission android:name="android.permission.INTERNET" />
.I would appreciate advice. I should mention that I am quite new to C#, and a complete noob with respect to MAUI and phone app development.
Per the Android developer docs you can use 10.0.2.2 when inside the emulator to reference the host machine.