当应用程序在设置内容可用后处于后台时,不会调用Android Rpush通知

当应用程序在设置内容可用后处于后台时,不会调用Android Rpush通知,android,ruby-on-rails-4,push-notification,ionic-framework,phonegap-pushplugin,Android,Ruby On Rails 4,Push Notification,Ionic Framework,Phonegap Pushplugin,因此,这是我的代码,当应用程序位于客户端的后台但不起作用时,将触发我的通知事件 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, not

因此,这是我的代码,当应用程序位于客户端的后台但不起作用时,将触发我的通知事件

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事件,即使该应用程序位于后台

有什么想法吗


谢谢

这对您来说可能太晚了,但请参阅以下讨论:。基本上,把你在
通知
中的所有东西都放进
数据
,这样就向Android发出了应用程序将处理的信号。@shadowbrush你救了我一天!您可以回答您的解决方案以获得所有学分。