How android application work with 3G/GPRS/EDGE - android

I developed an android app to receive a location and then send a message to collect at a MySQL server via XMPP protocol.
I want to know a differences between using WiFi and 3G/GPRS/EDGE.
If I use WiFi, it can connect to server directly, right? But if I use 3G/GPRS/EDGE, is it possible to send msg to server?
If possible, am I set up or need to do something to check the differences mobile connection?

Consider setting up an HTTP service that would pass parameters to the database and pass the records (if any) back. This way it will work over public networks for sure.

Related

Transmit android sensors to pc server

I am working on a project that gives notifications to a web application when some phone sensors change their values rapidly. I am new to android and even though I know how to get the sensors values in my phone, I'm not sure how to transmit them to my pc server. I will look into sockets for network/bluetooth transmitting, but is there any way to send it via the internet ?
Basically, I want my application to work like this: I connect to my android application on phone, I shake the phone a bit and then on my web application on pc I get some notifications. I was looking around and I saw working with a python server?
How should I proceed here? Which method should I use?
Use HTTP/HTTPS on the Android Client to send to your server. As that will be the easiest to program and most reliably way to get data off the phone regardless of network type. See HttpURLConnection for details. Just do a POST with your data to the web address.
If you don't want to just construct a simple PHP, ASPX, or other web service on top of a readily available HTTP server, then you can use a variety of HTTP server modules for Python. SimpleHTTPServer for example.

"Call" Android app from server using Ajax

I wish to create a Cordova/Android app that will be called/executed from my server. Both devices are on the same intranet and connect via WiFi, therefore no cloud messaging required .
For another scenario I have done the opposite. i.e. Android calls, via Ajax, an application on a Raspberry Pi for door opening purposes but this time I want to call an Android application from a Raspberry Pi. Where do I start? Ajax? Socket Server? What is the recommended connection method?
I think that websockets are the way to go. Implementing such a real time application allows you to 'push' data from the server to connected clients.
This can be initiated by clients (like in a chat application) but also by the server based on whatever events.
Have a look at Primus as a possible implementation. It abstracts the functionality from the websockets layer. This way it is possible to work with different websocket implementations.

Using a Network Socket to share Data bewteen two Apps on the Same Android device

My question is, is there a way for two Apps running simultaneously on the same Android device to pass information to each other via a network socket?
There will be two Apps running one will be sending data the other will be receiving the data sent.
The reason i want to send the data, between the Apps, in this way is because the App receiving the data will have to be able to receive data from a network socket at some point so id like to get the ground works of that in place.
So i was wondering if its possible to pass data from one App to another via its own network socket, and if so how would i go about doing it?
Are you aware of the UNIX sockets? We can use UNIX sockets for communicating between apps in the same device. Android supports it.
Helpful links:
1) http://beej.us/guide/bgipc/output/html/multipage/unixsock.html
But I am not aware of how to create UNIX socket in java layer. If you are aware of the JNI then you can create the UNIX socket in C and pass on the data between the Java<->Native layers.
Android supports local sockets:
https://developer.android.com/reference/android/net/LocalSocket.html

Two way communication between android and Server

i want a two communication between server and Android. From Android want to send my current location coordinates to server after each 10 minutes. i can send message or images to server at any time. Similarly from server i want to send data to Android whenever needed.
What should be the architecture of my application.
Communication from Android to server and Server to Android is independent of each other i should not ask it as a two way communication but infact i want communication from both sides to each other any time.
Should i use a Web service of any kind or just network sockets or Something else.
You can use websockets or...
Simply send data from phone to the server using normal request. When you want send something from server to telephone you can use push notifications (C2DM) and if you receive such push message you know that server has data for you and telephone can download it using normal request;-). It depends what data you want to send. Sometimes this approach will be good, sometimes it's better to use websockets, TCP sockets or even XMPP protocol ;-)
You can Use Acknowledge for the same. You need to Implement ACK/NACK Logic in your code. When you are sending Data just wait for ACK for a particular time period. If ACK is not received the you need to send NACK for the same. Here you need to use a session-id ( a kind of id for communication at both side, which can be any random number ).
You can use this Logic at both the side.

How to connect web service to android

I want to connect a web service to android phone i.e. a request is to be made from web service to android phone. All i can find is article about android to web service but in it (as far as i know..may be wrong) a request is sent to server from android but i want vice versa.
Most carriers give you an IP address inside their networks, so you can't access the devices through any standard method. If the device is online via WiFi then you may have a chance (depending on your ISP and router policies, and given the case you have a web server or a permanent socket listening for requests). Nevertheless, it's still a very bad idea.
I would recommend you to use a different approach: make your android device call a Web Service that recognizes it (either via IMEI, IMSI, both, or a user parameter, depending on your app) and see if it has some "news" for him. If it does, then it should take an action depending on the received data. If you're familiar to Java, it's roughly like the MDB (EJB) idea.

Categories

Resources