Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badges / Icons #28

Open
evinkuraga opened this issue Oct 31, 2018 · 3 comments
Open

Badges / Icons #28

evinkuraga opened this issue Oct 31, 2018 · 3 comments

Comments

@evinkuraga
Copy link

evinkuraga commented Oct 31, 2018

I'm getting 2 issues:

  1. When adding a badge to the content array, it fails to deliver.
  2. The icon doesn't show up. Are there any specific formats to sizes that cause it to crash? I'm using a 512x512png image pulled from an https

Here's my sample code:

$tokens = [FOO, BAR];

$message = new FcmMessage();
$message->content([
	'title'        => 'Test title',
	'body'         => 'foo bar',
	'sound'        => '',
	'icon'         =>  'https://storage.flixi.com/static/flixi_512.png',
	'badge'         =>  'https://storage.flixi.com/static/badge.png', 
	'click_action' => '' 
])->to($tokens);

If I remove the 'badge' key/pair, it works fine but doesn't show the image.

@nicoqh
Copy link
Contributor

nicoqh commented Nov 14, 2018

I'm not sure what devices you're sending to, but the badge key is meant for displaying the number of unread notifications on an iOS device. It should be a string, e.g. "2".

Also, the icon is only meant for Android and web devices.

@cacobala
Copy link

cacobala commented Jul 24, 2019

I think the badge image is acceptable for android devices. However, since this package only works with the Legacy HTTP Server Protocol, the badge is not supported. All of the available parameters are listed here: https://firebase.google.com/docs/cloud-messaging/http-server-ref

Apparently, with the HTTP v1 API you can actually set a badge for it:
https://firebase.google.com/docs/cloud-messaging/js/first-message#add_web_push_properties_to_a_notification_payload

@mohamedhussieen
Copy link

I'm not sure what devices you're sending to, but the badge key is meant for displaying the number of unread notifications on an iOS device. It should be a string, e.g. "2".

Also, the icon is only meant for Android and web devices.

how i can add counter to badge ?

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

No branches or pull requests

4 participants