Reputation: 7266
I am working on a mobile app (Android and iOS) to take delivery orders for a restaurant. The app allows the user to pick stuff from the menu, and when he is done I need to send his order to the program that I'll have running on the desktop computer of the restaurant.
My first and only idea so far is:
The usage of a server in the middle is because the restaurant has two branchs, in different cities, so with the server both restaurants can check the same HTML page and only pick orders on their own city.
Is my solution viable or should I try something else?
Thanks in advance.
Upvotes: 1
Views: 295
Reputation: 10550
My suggestion would be to have a web server handling all of the orders. So you would have your mobile device which would take the order and then post it to the database of the server. This would require having some web interface that includes a database.
Then I would write a separate desktop client to poll the server for new data changes. When a change is found, then it will download that new entry and display it to the employee.
So it would look like:
Phone ------>
Phone ------> -------> Desktop Client
Phone ------> <Web server>
Phone ------> -------> Desktop Client
Phone ------>
Upvotes: 1
Reputation: 1433
Sounds like you'd want to implement an API to which you can send your request. In Java you can do the following to send the request:
HttpURLConnection connection = (HttpURLConnection) new URl("yourURL").openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true); // this allows you to send data
connection.getOutputStream().write(yourOutgoingData);
InputStream is = connection.getInputStream(); // this actually sends the request and fetches any return data
Obviously you'll have to wrap some stuff in Try/Catch
. I would also suggest, instead of using a server in the middle, would it not be possibly to use DynDNS or No-IP so that you can send the request to the proper computer? These services allow you to 'attach' a permanent URL (yourname.dyndns.org) to your changing IP address, just enter your login details in your restaurant's router and when the IP changes it will be sent to DynDNS or No-IP.
Upvotes: 1