firebase / firebase/firebase-android-sdk

Request for Enhanced Control over Firebase Cloud Messaging Topic Subscription/Unsubscription Retry Mechanism.

Open
#6,388 0 comments 2 reactions 0 assignees View on GitHub
api: messaging type: feature request
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 9h
Merged PRs (30d)
31

Description

## What feature would you like to see?

When I was using the `subscribeToTopic()` and `unsubscribeFromTopic()` APIs of Firebase Cloud Messaging, I found that when the device cannot access the Google server, the relevant APIs will be retried indefinitely, and the developer cannot control and close the Firebase subscription process through threads such as the lifecycle.

I hope to leave the relevant retry operations to the developer, such as launching an API that "only attempts to subscribe once", so that the developer can receive an error callback and decide whether to retry after an error; or launching an API with a time parameter (for example, passing in 5000L means that if the retry fails after 5 seconds, the process will be closed and the error will be called back).

## How would you use it?

> The following is for reference only and does not mean that I require Firebase to implement the following APIs

- `subscribeToTopicWithTimeout(topic, timeoutMillis)` / `unsubscribeToTopicWithTimeout(topic, timeoutMillis)`
Indicates that the subscription operation is allowed to be retried within a given time. After the time exceeds the limit, the subscription is terminated and an error is callbacked.
- `subscribeToTopicOnce(topic)` / `unsubscribeToTopicOnce(topic)`
It means that it will be executed only once, whether it succeeds or fails, and a callback will be made to check whether it succeeds.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.