C
C#2mo ago
Raulino

✅ How can I connect my Xamarin app to my local API?

I have an API running in my machine and for test purposes I only need it to be local.
33 Replies
Raulino
Raulino2mo ago
It doesn't work with localhost, nor with my IpAdress Calling it in my own machine also doesnt work if I change the Ip from localhost to My IP
leowest
leowest2mo ago
I don't know about Xamarin but in MAUI you have to do some overly annoying things to get localhost working let me see if I can find hte thread https://discord.com/channels/143867839282020352/1221703280204451932/1221830944231657603 see if its something related to this if not just ignore me 😉 or the simplest u just disable https in the api
Raulino
Raulino2mo ago
Turned https off... the problem remains, and as well, even in postman in my own machine I cannot call my own IpAdress
leowest
leowest2mo ago
postman doesnt let u call localhost?
Raulino
Raulino2mo ago
This is so weird, I dont remember changing my config on these terms localhost yes, but when I place my raw IP it ignores
leowest
leowest2mo ago
well u just need localhost from xamarin as well but what is the other ip ur trying to use? 192...? 127...? or real external ip
Raulino
Raulino2mo ago
No description
Raulino
Raulino2mo ago
I tried 192, 127 i tried typing random numbers to see if I fool the xamarin app I will try again with http tho
leowest
leowest2mo ago
u have to add permissions to the manifest
Raulino
Raulino2mo ago
Not permitted. am I missing some file configuration here
No description
Raulino
Raulino2mo ago
Its a test for a vacancy... nothing will go public
leowest
leowest2mo ago
I mean the code is simple enough so why not anyway did it work?
Raulino
Raulino2mo ago
nope
leowest
leowest2mo ago
from the link above?
Raulino
Raulino2mo ago
I have my phone connected via USB, I dont know if makes any difference
leowest
leowest2mo ago
ah ok you're not using the emulator u would have to acccess it via the network ip it gives your phone then check the network details
Raulino
Raulino2mo ago
I tested with the IPV4 this is the one you reffering to?
leowest
leowest2mo ago
I mean u can just go to the mobile configuration and check yes ipv4
leowest
leowest2mo ago
No description
leowest
leowest2mo ago
that page would tell u so if it is 192 something then u would use your local 192 to access it then u would have to add it to your api which is probably only listening to localhost
Poller
Poller2mo ago
for such scenarios MS created the dev tunnels that are easy accessable in visual studio.
leowest
leowest2mo ago
ah true that is also an option forgot they added that but you can just add this line to your api's appsettings.Development.json as an alternative
"urls": "http://0.0.0.0:port"
"urls": "http://0.0.0.0:port"
change port to the port in your .http file then it will bind to localhost and other ips in your network card for the api
Raulino
Raulino2mo ago
not even the f tunnels are working And to connect to this one in my Mobile I access 0.0.0.0? nothing worked 🙂 WORKED!!! I'm not aware of what I did, but it worked. Thanks a lot guys you're awesome tbh now, I removed the https and retried sending to my IPv4 and wroked 👍
leowest
leowest2mo ago
nice 😉 yeah 0.0.0.0 just means bind to all my available ips so imagine u have: 192.168.0.100 as your internal ip 127.0.0.1 as localhost 1x.xxx.xxx.xxx as your external ip it will try to bind to all of those on the pre-defined port 😉 so u would be able to access it on any of those by default it only binds to localhost which is why u were unable to access it before ------======= I strongly suggest thou, that u move to MAUI if u haven't develop too much of the app yet xamarin is pretty much dead and MAUI took its place
MODiX
MODiX2mo ago
Use the /close command to mark a forum thread as answered
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
leowest
leowest2mo ago
do u think its worth it? its a lot of text
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
leowest
leowest2mo ago
this was the second time ever and dev tunnels exists now so I am unsure this would be worth the trouble over just doing dev tunnels
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
leowest
leowest2mo ago
thx for the suggestion thou I will look into writting something I been wanting to make a tag
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server
More Posts
I have made the mistake of choosing to use webforms please help( this is has to be done in webform)for some reason when i use Response.Redirect("QuestionForm.aspx"); it doesn't direct me to the form Error CS1502; Unity Mobile DevelopementHow do I fix this? ```public class DLLocalizationManager : LocalizationManager { public DLLocaliInstalling an App to unlock USB debuggingHello. I have a strange problem. I was given a task at work that requires me to display the screen I'd like to ask for a little help from someone who has used the HttpServer classI'm trying to implement this class in te Godot game engine but I can't make it receive http requestsUnity MonoBehaviour and Photon ConfusionI don't know how to program, but I'm trying to get an old Unity mobile game to run that seems to havList not returning all matching elementshey, I have this method ``` public List<T> GetStatementsOfType<T>() where T : ASTStatement { retCurrently Issues with Mapping (Mapperly), in debug mode when call made to API it exitsRepo: https://github.com/Mozin0/ProjectManagement/tree/main/ProjectManagement SubTasks mapping doessans-io pattern in .NET libraryI'm a big fan of writing sans-io implementations https://sans-io.readthedocs.io/ of various protocolALPHABETIC TELEPHONE NUMBER TRANSLATOR for ClassI have been trying to figure this out for a few days now. Here is the full question: "Many companiesReusing of types between GraphQL and RestHey, I'm currently working on some graphql mutations in my backend. The thing is that we support Res