I'm using the cordova plugin. Is there a way to take an action when the notification is actually received instead of having to wait for the user to click on it?

asked 14 Apr '15, 14:46
shenck's gravatar image

shenck
112

Hi,

Short answer is "not for Cordova".

The long answer is:
For iOS there is no way to perform the action before user clicked on a push notification. It is iOS requirement. Only when user clicks on push notification operating system runs the app and executes its code.

On Android it is possible on a Native app as push receiving code runs in a Service. However as the Service runs Native Java code and there is no Cordova JS wrapper available it is possible only on a Native app.

permanent link
answered 15 Apr '15, 07:16
shader's gravatar image

shader
3.9k7

Hello,

Am I correct that your question is related to the iOS platform?

It is possible by calling the onPushReceived:withNotification:onStart: method instead of the onPushAccepted:withNotification:onStart:

Please refer to the following links for more information about these methods:

https://rawgit.com/Pushwoosh/pushwoosh-ios-sdk/master/Documentation/Protocols/PushNotificationDelegate.html#//api/name/onPushReceived:withNotification:onStart:

https://rawgit.com/Pushwoosh/pushwoosh-ios-sdk/master/Documentation/Protocols/PushNotificationDelegate.html#//api/name/onPushAccepted:withNotification:onStart:

permanent link
answered 14 Apr '15, 15:05
Andrew_H's gravatar image

Andrew_H
3766

This is not a native app. This is related to the cordova (phonegap) plugin. The API only includes the methods listed in this link.

https://github.com/Pushwoosh/pushwoosh-phonegap-3.0-plugin/blob/master/www/PushNotification.js

The event for the push notification is only fired once the user clicks on the Notification. This is the same in iOS and Android. I need a way to fire off some work beforehand though and that is what my question is referring to.

Thanks.

(14 Apr '15, 17:58) shenck shenck's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×190
×111
×10

question asked: 14 Apr '15, 14:46

question was seen: 2,145 times

last updated: 15 Apr '15, 07:16