ios 5推送通知和rhomobile
问题描述:
我可以推送工作,除了应用程序关闭时进入的消息。ios 5推送通知和rhomobile
消息并显示在通知中心,但只有通过当用户点击的实际味精1加1
有谁知道是否有获取所有从通知中心与消息的方式到App Rhomobile的?
答
任何有兴趣,
无法找到一个方法来检索从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
添加然后在控制器。 rb里面的Settings文件夹
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