Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Android - Don't display system notification if not needed #178

Closed
roccozanni opened this issue Mar 23, 2016 · 8 comments
Closed

Android - Don't display system notification if not needed #178

roccozanni opened this issue Mar 23, 2016 · 8 comments

Comments

@roccozanni
Copy link

Hi,
here at Spreaker we use GCM to notify our mobile apps that they need to sync new data, so we basically send a notification to tell the app that some kind of data are changed and they need to be synced.

We started with Android and now we're working on porting the same features on iOS, but in order to have GCM deliver the notification to the app while is in background we needed to add the content_available parameter. No issue on iOS side but the Android app started behave differently that before.

We target play services 8.4 and we discovered that this version introduced the auto-display of the system notification in content_available is specified. The issue here is that there isn't anything to display because we intentionally don't fill the notification field, but the system displays an "empty" notification with just the app icon and the name of the app. We discovered that this behaviour is implemented in GcmListenerService that checks if the value of gcm.notification.e is 1 but providing fallbacks value for all the values of the notification field if not specified.

The gcm.notification.e field seems to be automatically added to the notification by GCM when content_available is true, but we have been able to override it by adding the notification field with a value of {"e":0}.

This is clearly an undocumented feature, and we think it will be safer if will be fixed in the GCM server (using gcm.notification.e=0) or in GcmListenerService client by checking if the user don't specify anything in the notification field.

Thanks,
Rocco

@ogeidix
Copy link
Contributor

ogeidix commented Apr 6, 2016

Hi Rocco,

I am investigating the issue you reported.
Will update the thread soon.

thanks for your report

  • Diego

@macecchi
Copy link

macecchi commented Apr 7, 2016

I've also encountered the exact same problem as you. I took a while to realise this was a bug... I did not find a solution that covered all the cases, and eventually I gave up background notifications on iOS when the app is closed. This issue should be top priority as this is a big problem when implementing support for the two platforms at the same time.

@ogeidix
Copy link
Contributor

ogeidix commented Apr 21, 2016

The fix has been completed server-side, and should be deployed in production next week.

@ogeidix ogeidix closed this as completed Apr 21, 2016
@atrepeklis
Copy link

I am still getting the issue is it still not deployed or ...?

@ogeidix
Copy link
Contributor

ogeidix commented Apr 26, 2016

Not yet. It will happen in the next days

@bearprada
Copy link

hi @ogeidix did you deploy this fix yet?

@ogeidix
Copy link
Contributor

ogeidix commented May 25, 2016

yes, the issue has been fixed.
Are you still experiencing this?

@bearprada
Copy link

@ogeidix I'm not sure it's related to this PR, I used FCM SDK(9.0.0) in client site, and our server sent the notification through GCM. I need to do more test on it. I will keep you posted.

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

5 participants