0

So this is my code to get my notification event to be fired when the app is in background on the client side but it doesnt work.

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

I thought with the content_available parameter allows the onNotification event from the mobile app side to be triggered even if the app is in background.

Any thoughts on this?

Thanks

Kingsley Simon
  • 2,090
  • 5
  • 38
  • 84
  • 1
    This comes probably too late for you, but refer to this discussion: https://github.com/phonegap/phonegap-plugin-push/issues/387 . Basically put everything you have in `notification` into `data`, thus signaling to Android that the app will handle the processing. – shadowbrush Apr 29 '16 at 05:21
  • @shadowbrush you saved my day! You can make an answer of your solution to earn all the credits. – Jay Dinse Aug 11 '16 at 13:41

0 Answers0