Hi all,

if the cordova based app is closed or in the background, I would like to perform one action, if the app is open (as in, the app the user is currently looking at) I would like to perform another.

Closed app = Open app and navigate to a certain page (works as expected)

Background app = Bring the app to the front and go to a certain page

Foreground app = Show a toast notification (works as expected)

My issue relates to not being able to differentiate between background and foreground when the "push-notification" event is fired.

Anyone had to solve similar?

Ta! :)

asked 02 Dec '14, 18:25
ct14's gravatar image

ct14
514

Did you try "onStart" parameter in push notification?

permanent link
answered 03 Dec '14, 04:21
shader's gravatar image

shader
3.9k7

Hi Shader, is there any documentation for the "onStart" parameter? Specifically for a Cordova project?

Thanks -Chris

permanent link
answered 03 Dec '14, 10:23
ct14's gravatar image

ct14
514

It is in the root of push payload. it is set to true if the application was in background when push received, false otherwise.

(03 Dec '14, 13:22) shader shader'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
×141
×39

question asked: 02 Dec '14, 18:25

question was seen: 1,441 times

last updated: 03 Dec '14, 13:22