phpandroidwebserverpushreverse-ajax

Fetch data from Android to webserver


I have a certain concept in mind, but I an unsure what my possibilities are.

  1. User enters a name (html form) on a webpage
  2. Webserver sends push notification to the Android device of the user
  3. Application looks for this name in the contactslist and finds the corresponding phone number
  4. Application instantly sends this information back to the webserver, where the user can use the returned phone number.

The only step I am unsure about is #4. I presume I'd have to use a temporary MYSQL database and use reverse AJAX or something alike to get the returned data to the user without him having to refresh the page (this entire process needs to be completed within a couple of seconds at most - the faster, the better). This all sounds like a very hack-ish approach to me though, I was hoping any of you could hint me with better ways of tackling this - or maybe a good resource to the approach I described. It's hard to find solutions when you're not sure what it is you're looking for.

Much obliged!


Solution

  • I can think of two ways of solving #4

    1. poll "did I get the response yet?, did I get the response yet?..."
    2. or use websockets. here's a post I found that might be useful: post

    Here's one interesting approach to it all using node.js: nowjs

    If you plan to use Androids C2DM, check out the min-max delivery times.