Results 1 to 9 of 9

Thread: How to make Xamarin Android App talk to VB Desktop Application

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    7

    How to make Xamarin Android App talk to VB Desktop Application

    I have just spent about a week solid creating a Menu/Ordering app for Hospital Patients.
    The app works really well except for the most important part.
    There doesn't seem to be any way to get the vb desktop app (which has all the patient info) to talk to my Android app which has the food orders and vice versa.
    The Android app needs to know what patients are in what rooms and then send an order to Desktop when created.
    If anyone out there has any ideas I would be most grateful.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,689

    Re: How to make Xamarin Android App talk to VB Desktop Application

    I don't use Xamarin so maybe I'm wrong but I wouldn't expect that they would talk to each other. They would each talk to the same server. Maybe that server is just a database containing shared data or maybe its something smarter that can push notifications to the app and/or the Windows application.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,379

    Re: How to make Xamarin Android App talk to VB Desktop Application

    If the two devices are going to be on the same LAN, then you could just use something like UDP or TCP directly. I would expect that Xamarin could do that and the desktop certainly could. It sounds like the information transfer might be well suited for UDP, so TCP might be overkill. However, you (mostly) do need to be on the same LAN for this to work. If they aren't on the same network, behind the same firewall, then you'd be dealing with opening ports in the firewall, which you really don't want to be doing.

    This would be a more peer-to-peer approach than what JMC suggested. His solution is somewhat more robust, and could be made to work outside the firewall through something like a WebAPI. It could have some other advantages, as well, such as not needing to have both the Xamarin and desktop applications running simultaneously. The communication on one end wouldn't have to necessarily be at the same time as the communication on the other end. However, it is also a heavier weight solution, as it would require a third device and two channels of communication.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    7

    Re: How to make Xamarin Android App talk to VB Desktop Application

    Thanks Shaggy Hiker, after a quick google, it sounds like UDP might be just the thing. However the week I spent creating this App also included learning C# and Xamarin Forms so I think implementing UDP might be beyond my (very) limited skill set.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,936

    Re: How to make Xamarin Android App talk to VB Desktop Application

    In that case something along the line of jmcilhinney's idea is probably the way to go.

    Presumably you currently have two separate databases (one for the VB app, and one for the Xamarin app), so creating some kind of link between the databases would allow the data to transfer between them as needed.

    You could do that by getting each of the apps to talk to both of the databases (which would mean you would need to write code to match the data from one database to the data from the other), but you could also do it by creating a link between the databases (so that you can treat a table from the other database as if it is in the same database).

    Creating a link between the databases is probably the easiest option, but exactly how you would do it depends on the kinds of databases involved (eg: an Access mdb file has different methods to an SQL Server database).

  6. #6

    Re: How to make Xamarin Android App talk to VB Desktop Application

    Considering your situation, it seems using UDP might be a suitable solution for communication between the Xamarin Android App and the VB Desktop Application; have you explored any specific resources or tutorials to guide you through the implementation of UDP in your Xamarin project?

    Given the need for real-time communication between the Android app and the desktop application, have you considered exploring other communication protocols or solutions beyond UDP, and what factors influence your choice of the best approach for your specific project requirements?

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,427

    Re: How to make Xamarin Android App talk to VB Desktop Application

    Quote Originally Posted by deanobravo View Post
    Thanks Shaggy Hiker, after a quick google, it sounds like UDP might be just the thing. However the week I spent creating this App also included learning C# and Xamarin Forms so I think implementing UDP might be beyond my (very) limited skill set.
    UDP is very hard to implement right and it is mostly never the right protocol for the job.

    Just use a local http-based API server (this at least is TCP, not UDP) as a central database and let both apps talk to it using JSON or something easy to implement.

    I'm surprised you didn't go for client-server approach for your mobile app in first place. How to you share the common menu du jour between couple of devices?

    cheers,
    </wqw>

  8. #8

    Re: How to make Xamarin Android App talk to VB Desktop Application

    Have you considered exploring a client-server approach with a local HTTP-based API server as a central database for communication between the Xamarin Android App and the VB Desktop Application, leveraging TCP for more straightforward implementation?

  9. #9

    Re: How to make Xamarin Android App talk to VB Desktop Application

    Quote Originally Posted by SaxonDit View Post
    Have you considered exploring a client-server approach with a local HTTP-based API server as a central database for communication between the Xamarin Android App and the VB Desktop Application, leveraging TCP for more straightforward implementation?
    Exploring a client-server plan with a local HTTP-based API server is a great way to connect a Xamarin Android app to a VB Desktop client. It would allow both systems to link up more effectively with the API server serving as a central data hub. Using TCP for setup could ease matters by providing an efficient communication layer, making data flow between the two apps easier. This set up could boost scalability and provide easier interaction across platforms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width