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.
Asked
Active
Viewed 904 times
1 Answers
0
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.

Vicente Plata
- 3,370
- 1
- 19
- 26
-
So for example i have IMEI for 1 device, how would i connect to it from my web service? – my_life_as_binary May 10 '11 at 08:15
-
Please, read my answer. You should not connect to the device: the device should ask for new messages or actions or whatsoever passing it's IMEI as an identifier. Then you would know if the device needs to do anything. Read the first paragraph about why you can't and/or shouldn't connect to your device directly. – Vicente Plata May 10 '11 at 08:17
-
Oh.k! So can this be achieved through synchronization as device can request regularly and then we can get response, right? – my_life_as_binary May 10 '11 at 08:22
-
Indeed! That's the best approach I can think of and actually the one I've used so far. – Vicente Plata May 10 '11 at 08:23
-
Thanks for your help (and patience :) i m newbie. – my_life_as_binary May 10 '11 at 08:25
-
btw can you share any tutorial or some URL related to it? – my_life_as_binary May 10 '11 at 08:26
-
SOAP: http://stackoverflow.com/questions/297586/how-to-call-web-service-with-android or REST: http://breaking-catch22.com/?p=127 – Vicente Plata May 10 '11 at 08:28