Skip to content

FR: Surface notification_count to AndroidNotification builder #308

Description

@knocknarea

Step 2: Describe your environment

  • Operating System version: Server (Mac/Linux)
  • Firebase SDK version: 6.10.0
  • Library version: N/A
  • Firebase Product: cloud messaging (auth, database, storage, etc)

[REQUIRED] Step 3: Describe the problem

Unable to set the android badge count via the Builder methods for AndroidNotification.

The json spec suggests this is the location to set such data, however, this is not surfaced to the builder yet.

Steps to reproduce:

I am trying to issue a Push Notification through FirebaseAdmin from my server and I can set the badge count on APNS using

builder.setApnsConfig(
  ApnsConfig.builder().setAps(
  Aps.builder().setBadge(badgeCount).build()).build());

Relevant Code:

However, there is no equivalent method on the AndroidNotification class to set the notification_count (even though it is specified in the json spec)

https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification

Ideally... ?

builder.setAndroidConfig(
 AndroidConfig.builder().setNotification(
 AndroidNotification.builder().setNotificationCount(badgeCount).build())
 .build());

Maybe there's another way to do this, but I prefer to use the Admin SDK. Apologies if I am barking up the wrong tree.

Activity

  1. hiranya911 commented on Sep 6, 2019

    @hiranya911
    Contributor

    Badge is an APNs-specific property and not supported on Andriod AFAIK.

    @chong-shao can you confirm?

  2. knocknarea commented on Sep 6, 2019

    @knocknarea
    ContributorAuthor

    @hiranya911 it's not the badge property I'm after, it the notification_count property of the AndroidNotification Json spec.

    Not all of the properties of the spec are surfaced to the AndroidNotification class.

  3. hiranya911 commented on Sep 6, 2019

    @hiranya911
    Contributor

    Oh ok. Feel free to send a pull request.

  4. chong-shao commented on Sep 6, 2019

    @chong-shao
    Contributor

    Yes notification_count https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification is documented in the HTTP in the API but currently hasn't been added into AdminSDK. Feel free to send a pull request.

  5. added a commit that references this issue on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions