Communication between app and server over cellular network - android

I'm developing an Android application that communicates with a Rails server. When the application is run on the same network as the Rails server, everything works well (I can access my database on the server). However, when I use the 4g internet on my phone, I can't connect with the server.
My question is, how can I modify my Android app/Rails server so that my Android app can contact my rails server without having to be on the same network?
Thanks in advance!

Make sure you're not starting the server in development mode. Generally, in development mode the server accepts by default only requests from the same machine (no network connections are accepted).

Related

Send local message from an Arduino to a Flutter app on Android/iOS?

I have a need to send a message from an Arduino to a Flutter app on a local WiFi network. I was thinking I could perhaps run a HTTP server on the mobile device and just make a GET/POST request from the Arduino, but I can't seem to find a http server plugin for Flutter which would run on a mobile device.
Any ideas how to accomplish this? I know I could use something like Firebase or Blynk, but it would require the devices to have Internet access, which I would want to avoid.

How to use Web Apis to get data from the server without internet connection in android?

I have created a web application in ASP.NET MVC5 and I want to create an android app for it. If I have a SQL server database in my laptop, is it possible to that I create android project in android studio, connect my phone with laptop, install apk ,and insert/retrieve data to/from my database located on my computer.
I have deployed my web application to a remote server and I know Restful web api's can be used to retrieve data from the server but it will require an internet connection on my phone, right? I have used RESTFUL web api's in my web application.
You can use Web Api's to get data from server without internet only in local area connection , in which you have server and your android application linked to some local area network. But if you want to get data from remote servers you have to use Internet connection. Hope this helps.

sending data from my android app to my computer via internet

is it possible to let my android app send data(or better, files) to my computer (windows 10) via internet(e.g. both being connecting to a wifi, but not necessarily the same)?
In your cases if not in the same network then the phone needs to send the data to a server database then you computer my get the data from that server.
You may user a locally hosted server wamp or host it on one of the many free/paid for hosting services available
For simple data sync you may use php & mysql on the server side and json from the app.

Syncing between a local network and Android application

I am in need of some help here.
I want to make an Android application that eventually syncs to a web server in order to get information (i.e. user can write a note through the website, and it automatically syncs to the phone).
I am aware that I would need some web servers and hosting, and don't know too much about that so I will look into it later.
MY question, however, is how I can simulate this over a local network?
As in, if I create a basic webpage that has a two text boxes (one for name, one for content) and a 'submit' button, if I run it via localhost WHAT methods can I use to get this information to sync to my handset?
If anyone could be kind enough to give me a laymens terms breakdown it would be seriously appreciated, I feel so lost!
You have some alternatives to achieve what you want, here is a traditional one:
Start with installing XAMPP and run a local server
Write your web pages, store the data in mysql
Write PHP code to extract the data from mysql
Use Android HttpClient to call your PHP
There are other alternatives:
Use the same method but instead of PHP write HTML5 and you have a mobile WEB application
Check out the GCM Demo Application
Check out Google App Engine
Check out Amazon Web Services
There are others
Enjoy :)
Yaron
When you use localhost (meaning you install a server package such as Apache / IIS / XAMPP / WAMP in your computer), your machine becomes a server. So, you can access the localhost from any device which is in the same network.
Say you have a computer connected to a WiFi router. If you setup the server i.e. the localhost in that computer and a laptop and a mobile phone is connected to the same WiFi router, the phone and laptop will be able to get service from the computer.
To access data stored in the MySQL server from the other devices (e.g. the phone), you have to write proper service. Else, you can write a mobile web app in the server that accesses the MySQL data and just access it from the device.

Using Tomcat server to host android and web application opens too many connections

I have an Web application running on my Tomcat server v7.0. Now I'm creating an android app and it will connect to MySQL database. For this, I'm going to send requests to this server, and this server will get data from database to Android app.
Now, I'd like you to think on the situation: if I have 1000 users connected to my webPage and more 1000 users getting data from MySQL database (as I said, the server will be in the middle of the communication between MySQL and Android), will my Tomcat server open 2000 connections?
I'm know it's difficult to the server receives such number of connections at the same time, but what I'm wondering is: will Tomcat server closes connections once the request is done?
I don't know if it is useful to answer this question, but I'm using spring MVC framework in the web application and Android spring in the Android application.
That is what JDBC connection pools are for. Take a look at the documentation on how to configure them

Categories

Resources