Fetch data from Android to webserver

寵の児 提交于 2020-01-06 16:19:35

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/5858412/fetch-data-from-android-to-webserver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!