ios 5 推送通知和 rhomobile

发布于 2024-12-22 05:01:54 字数 128 浏览 5 评论 0原文

除了应用程序关闭时传入的消息之外,我可以让推送工作。

消息确实会显示在通知中心上,但只有当用户一一点击实际消息时才会传递到应用程序。

有谁知道是否有一种方法可以使用 Rhomobile 从通知中心获取所有消息?

I can get push working except for messages that come in while app is closed.

Messages do show up on Notification Center, but only passed to app when user clicks on the actual msg 1 by 1.

Does anyone know if there is a way to fetch all the messages from the Notification Center with Rhomobile?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对于任何感兴趣的人,

无法找到从 iOS 通知中心检索通知的方法,因此我执行了以下操作:

添加到 application.rb

def on_activate_app 
    # Had to do this for iOS not getting all the messages from Notification Center 
    Rho::Timer.start(100, "/app/Settings/check_for_pending_friends", "nil") 
    super 
end

然后添加到 Settings 文件夹内的controller.rb

def check_for_pending_friends 
  person = Person.find(:first) 
  url = "http://my_app.com/users/#{person.remote_id}/pending_msgs 
  # which looks for any msgs sent to that person with read_at = nil from server 
  Rho::AsyncHttp.get( 
     :url => url, 
     :headers => {'User-Agent' => Rho::RhoConfig.user_agent}, 
     :callback => url_for(:action => :see_if_pending_messages_callback) 
   ) if person 
end 

def see_if_pending_messages_callback 
  # Check to see if msg does not already exist in device, if not then add it 
end

For anyone interested,

Could not find a way to retrieve notifications from iOS Notifications Center so I did the following:

added in application.rb

def on_activate_app 
    # Had to do this for iOS not getting all the messages from Notification Center 
    Rho::Timer.start(100, "/app/Settings/check_for_pending_friends", "nil") 
    super 
end

Then in controller.rb inside the Settings folder

def check_for_pending_friends 
  person = Person.find(:first) 
  url = "http://my_app.com/users/#{person.remote_id}/pending_msgs 
  # which looks for any msgs sent to that person with read_at = nil from server 
  Rho::AsyncHttp.get( 
     :url => url, 
     :headers => {'User-Agent' => Rho::RhoConfig.user_agent}, 
     :callback => url_for(:action => :see_if_pending_messages_callback) 
   ) if person 
end 

def see_if_pending_messages_callback 
  # Check to see if msg does not already exist in device, if not then add it 
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文