douhao3562 2011-10-23 06:14
浏览 10

如何链接Android应用程序和Web服务?

I made an Android application and I have a web-service (written in PHP). The service must send a message to application, so while my Android application works in the background and monitors web-service, it gets the message from service.

How can I organize this interaction? Thank you

  • 写回答

2条回答 默认 最新

  • dpp3047 2011-10-23 11:28
    关注

    C2DM is probably the most efficient way to push notifications to your android phone (no extra polling needed). Give it a look.

    If you want to do it with the background service, you can set the service to be woken up every x minutes with AlarmManager and send http request to your server to check for updates. However this does consume battery if you do it too often.

    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决