アプリを閉じている間に届くメッセージを除いて、プッシュを動作させることができます。
メッセージは通知センターに表示されますが、ユーザーが実際のメッセージを1つずつクリックした場合にのみアプリに渡されます。
Rhomobileで通知センターからすべてのメッセージをフェッチする方法があるかどうか誰かが知っていますか?
アプリを閉じている間に届くメッセージを除いて、プッシュを動作させることができます。
メッセージは通知センターに表示されますが、ユーザーが実際のメッセージを1つずつクリックした場合にのみアプリに渡されます。
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
次に、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