Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

on_notification not triggered when app in background in android #52

Open
itsrifat opened this issue Mar 19, 2017 · 2 comments
Open

on_notification not triggered when app in background in android #52

itsrifat opened this issue Mar 19, 2017 · 2 comments

Comments

@itsrifat
Copy link

I have set up the project for both ios and android. onNotificationOpened and onNotificationReceived works fine for android, but nothing happens if the app is in background. For ios, on_notification gets triggered in background if the background processing flag is turned on for a message in Urban Airship. Am I missing something?

@itsrifat
Copy link
Author

itsrifat commented Mar 22, 2017

I did some digging around and looks like Line 24 of ReactNativeUAReceiver.java is always returning false when the app is in background, an hence ReactNativeUAEventEmitter's sendEvent is not getting triggered.

If I comment out the isRunning check on line 26,

if (ReactNativeUAEventEmitter.getInstance() != null) // instead of if (isRunning && ReactNativeUAEventEmitter.getInstance() != null) 

My on_notification code on the js side gets executed fine whether the app is in background or foreground.

Is there any way around this?

@arthursz, Any thoughts?

@rlepinski
Copy link
Collaborator

@itsrifat It looks like react only gets setup from an activity. Thats not always going to happen when an Android application is woken up in the background, so the react context will not be setup. This seems to be a limitation with react and not this plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants