I want to send a message to a PHP script on a server from one android device using HttpURLConnection and have the PHP script send the message to a second phone using file.getContents().
When a phone connects with the server is it possible to leave the phone waiting for a response by not echoing a response?
Can I then later use the same connection to respond to the device by executing file.getContents() and passing in the IP address of the device that had initially connected?
Thanks!
Related
I am implementing a GCM server communication using PHP. I have implemented the code in PHP and able to send the messages successfully to the device. But when the device isn't connected to network the message is lying in the server. The PHP is getting a success response. When the device network is turned on the message is getting actually sent to the device.
My question is that is there a way that I can get back from the GCM server or ping GCM server to know the status of the message_id I sent.
You need to use Upstream Messages. It has a delivery receipt requested feature. Check out this documentation here : http://developer.android.com/google/gcm/ccs.html#receipts
If you use the simple HTTP communication with the GCM server, your only way to know if the app received a message is to put some message identifier in the message payload (not the message identifier returned by GCM server, since you can't access that in the app), and to send that message identifier from your app to your server when the message is received.
I am developing an app in android in which i am making use of json parsing to get data from php file and also sending data to php file from android. This time I am running my app on emulator so I am passing ip address of emulator i.e. 10.0.2.2. Now I want to run that app on android device,so what ip address is needed to passed instead of emulator's address?
I have tried to set up a Soap connection between a Php client and making the Android app as a server. I tried it by getting the Android device Ip address and setting a request in php client..? I was not successful in doing so. Need some help with this.?
How to make my android app to get my php server's IP address?
Example, android app sending broadcast message. Then my server listen that message and send the server's ip address to the android app.
Phone ----> Send broadcast message for requesting IP Address
Server <----- Receive the message
Server -----> Send the IP Address information to phone
Phone <---- Receive the information and save the server's IP Address. Finish
I found JmDNS but, my server is PHP not Java. Or, there is a trick or solution the do that job?
I wanted to know if I am accessing a website using my curl script, will the TCP connection be initiated from the client who has opened the PHP page (that is my PC) or the server where the PHP page is hosted?
Is there any way to verify this ? I tried to open whatismyipaddress.com using my curl script to check what IP address it is showing but it did not show any IP address thinking the request came from a BOT.
It will be from the server. Curl is an executable binary on the server and will execute as such. If you choose to display any output the server will push that output back down to the client.
The client only receives HTML code generated in your server so, all happens in your server and therefore the connection is opened from your server.