2011-12-18 61 views
0

我可以推送工作,除了應用程序關閉時進入的消息。ios 5推送通知和rhomobile

消息並顯示在通知中心,但只有通過當用戶點擊的實際味精1加1

有誰知道是否有獲取所有從通知中心與消息的方式到App Rhomobile的?

回答

0

任何有興趣,

無法找到一個方法來檢索從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