Sending information between PC (Windows Form, C#) and Android

Asked

Viewed 402 times

3

I started to elaborate a project scheme, and as an idea I had to have several Androids devices sending data to a computer (I plan to do using Windows Form - C#, and maybe Xamarin for Mobile part).

I ended up getting doubt in the best way to send the data (Bluetooth, Wifi.. because until then never did something similar).

Someone could help me out with the way it would be better (smaller drop of connections to the computer)?

Obs - I know there is an api that works with bluetooth (32feet), but still my doubt remains which one would be better.

Thank you all :D

2 answers

1


The best solution is for you to expose an API (may be in your Forms application) so you can use the Nancyfx, or create an API project separately.

inserir a descrição da imagem aqui

In this API you will have Endpoints and by the application in Xamarin you can call these endpoints to send/receive information (GET/POST/PUT/DELETE).

This operation can be via Wifi or you can expose this also on the Web (you must configure DMZ or NAT for your computer of the local network that is with the application).

Useful links:

Xamarin Forms - Consuming an ASP . NET Web API with Httpclient

http://www.macoratti.net/17/03/xamforms_webapi1.htm

Consuming a Restful Web Service

https://developer.xamarin.com/guides/xamarin-forms/cloud-services/consuming/rest/

On my Github you have an example Webapi that can be used as a basis for your project as well:

https://github.com/thiagoloureiro/WebAPIBase

  • What’s the reason for the downvote? Where’s the person who commented and deleted it? Nancyfx It’s not just for ASPNET.. Microservices in Console APP use Nancyfx for example.

  • 1

    Exactly what I needed. Thank you very much!

  • Wonder Albert! Need more help I am available. https://medium.com/@thiagoloureiro/ write there that we keep in touch.

1

If you want to do something broad, with access to several computers and few requirements, I recommend using Wi-Fi. So you can work using network sockets and no third party API is required to send/receive this information.

Use of Wi-Fi would be for both external and local access, using the local network to emulate all information collected. To do something external (that does not use local network), it would be necessary to host a server application at a public address for mobile applications to send the information to this server.

Information loss on Wi-Fi is caused when the transmission is intercepted by metals, long distances, etc.

Using Bluetooth gets more complicated, it would have to make Win32 calls and few computers have a Bluetooth sensor. Unless you are doing this for a group of computers with specific Hardware whose there is the sensor will need to do a good installation, because what influences the loss of Bluetooth data is virtually the same as the Wifi.

For me, using local Wi-Fi network is the most effective.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.