所以这是我的代码,当应用程序在客户端的后台运行时,它会触发我的通知事件,但它不起作用。
n = Rpush::Gcm::Notification.new
n.app = Rpush::Gcm::App.find_by_name("partners")
n.registration_ids = [@user_auth_token.device_token]
n.data = { state: "case_status_single", count: badge_unread.length + 1, notification_id: n.id}
n.content_available = true
n.notification = {
body: @loan_application.name + " Loan Status Changed to: " + AgentAssignmentStatus.find(p.agent_assignment_status_id).assignment_status,
title: Partners',
tag: true
}
n.save!
Rpush.push
我认为使用content_available参数可以触发来自移动应用程序端的onNotification事件,即使应用程序处于后台也是如此。
对此有何想法?
谢谢