Home > Enterprise >  How can I receive events from a Xamarin App into my ASP.NET web app?
How can I receive events from a Xamarin App into my ASP.NET web app?

Time:12-31

I am developing a project using .NET that connects to a SQL database with Microsoft Azure. I have two .NET projects, one is a mobile app using Xamarin, and the other is a normal C# application called DesktopProgram.

DesktopProgram is too big to run well on a phone. Therefore, I need to leave the UI on the mobile app, and the DesktopProgram in the cloud. Both projects will have to communicate with each other, and DesktopProgram has to communicate with the SQL Database.

If I make my DesktopProgram an ASP.NET project with all the C# logic, will it be able to send and receive events from the mobile app?

Is there a better way to do this? I need a way to execute the C# code, and get input and send output to the mobile app and SQL database. That means that no UI is needed for the web application.

Thanks in advance!

CodePudding user response:

  • You need to create a Web API project to access events in Xamarin Form.

  • Create a cross-platform application (Xamarin.forms)

  • Add a NuGet package for managing HTTP requests and fetching data.

  • Http class provides a base class for sending and receiving requests from a URL. It is a supported async feature of .NET framework. HttpClient is able to process multiple concurrent requests. It is a layer over HttpWebRequest and HttpWebResponse.

  • Please refer Fetch Data Using Web API in Xamarin.Forms and Consume ASP.NET Core Web API in Xamarin Applications for more details.

  • Related