How and on what condidtions are FCM high-priority messages de-prioritized? How to fetch cached FCM messages...
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
According to FCM documentation high-priority messages might become de-prioritized, if the FCM server detects a pattern in which high-priority messages do not result into user interactions. The details of this mechanism are left unspecified. Questions:
- How exactly does this work?
- How does the detection algorithm gathers the data?
- For how long are messages de-prioritized?
Secondly, the Android app has a method that checks how old the most recently received message is. This methods sometimes reports wrong results, if messages with normal priority have not been delivered yet but are still cached at the FCM server. Question:
- How can make the Android app to fetch all messages first?
Some optional background information:
I am writing a monitoring app for some safety critical application. The on-premise server can be in one out of two mutually exclusive states: "idle" or "alarm". The state is sent via FCM to all registered clients. To ensure that the server is still running, the state is periodically broadcasted as a heartbeat. These heartbeat messages are sent with normal priority. Moreover, whenever the state changes from "idle" to "alarm" an additional, offbeat message with high priority is sent immediately. E.g. the sequence of messages is something like
... idle idle idle *alarm* alarm alarm alarm idle idle ...
As the first alarm message in a row triggers a notification and all other messages have only normal priority, there is (hopefully) no risk of being de-prioritized by FCM.
The Android app incorporates a PeriodicWorkRequest
that serves as a watchdog and checks if the heartbeat is still coming in. If the most recently received message is too old (older than 30mins), a "Connection lost" notification is displayed to the user to warn him.
Here is the problem:
The usual heartbeat messages have normal priority and are cached at the FCM server. The watchdog raises a false "connection lost" notification. The device is woken up (due to the notification) and suddenly the most recent heartbeat message comes in (they are collapsed at the server).
I see two solutions (or workarounds):
Make all messages high-priority messages, so that they are delivered immediately and the watchdog always sees the most recent message. However, I fear that the FCM de-prioritization algorithm kicks in. (99,95% are boring "idle" messages)
Before the watchdog checks the time of the latest message and eventually raises a warning, I have to ensure programmatically that all messages have been fetched.
Side note:
I totally understand why Google is enforcing more and more restrictions on background executions and asynchronous tasks. (Broadcast receivers have become more or less useless, AlarmManager has been restricted, JobScheduler can be deferred and Android 9 introduces the concept of "standby buckets".) Many developers have abused these APIs to do insane things for which a better (battery-friendly) solution would have existed. However, all these restrictions make it a very hard job to implement a safety-critical application that is governed by legal regulations, that must provide reliability guarantees and therefore requires line-monitoring of an unreliable network.
All the power management mechanism do not seem to consider safety-related scenarios. The user has no intent to use the app (which is perfectly fine) and no news are good news in this particular case. I.e. the app simply stays in the background. Unfortunately, the app is categorized into the standby bucket for "rare" apps and the app gets penalized which is not good.
android push-notification firebase-cloud-messaging watchdog android-background
add a comment |
According to FCM documentation high-priority messages might become de-prioritized, if the FCM server detects a pattern in which high-priority messages do not result into user interactions. The details of this mechanism are left unspecified. Questions:
- How exactly does this work?
- How does the detection algorithm gathers the data?
- For how long are messages de-prioritized?
Secondly, the Android app has a method that checks how old the most recently received message is. This methods sometimes reports wrong results, if messages with normal priority have not been delivered yet but are still cached at the FCM server. Question:
- How can make the Android app to fetch all messages first?
Some optional background information:
I am writing a monitoring app for some safety critical application. The on-premise server can be in one out of two mutually exclusive states: "idle" or "alarm". The state is sent via FCM to all registered clients. To ensure that the server is still running, the state is periodically broadcasted as a heartbeat. These heartbeat messages are sent with normal priority. Moreover, whenever the state changes from "idle" to "alarm" an additional, offbeat message with high priority is sent immediately. E.g. the sequence of messages is something like
... idle idle idle *alarm* alarm alarm alarm idle idle ...
As the first alarm message in a row triggers a notification and all other messages have only normal priority, there is (hopefully) no risk of being de-prioritized by FCM.
The Android app incorporates a PeriodicWorkRequest
that serves as a watchdog and checks if the heartbeat is still coming in. If the most recently received message is too old (older than 30mins), a "Connection lost" notification is displayed to the user to warn him.
Here is the problem:
The usual heartbeat messages have normal priority and are cached at the FCM server. The watchdog raises a false "connection lost" notification. The device is woken up (due to the notification) and suddenly the most recent heartbeat message comes in (they are collapsed at the server).
I see two solutions (or workarounds):
Make all messages high-priority messages, so that they are delivered immediately and the watchdog always sees the most recent message. However, I fear that the FCM de-prioritization algorithm kicks in. (99,95% are boring "idle" messages)
Before the watchdog checks the time of the latest message and eventually raises a warning, I have to ensure programmatically that all messages have been fetched.
Side note:
I totally understand why Google is enforcing more and more restrictions on background executions and asynchronous tasks. (Broadcast receivers have become more or less useless, AlarmManager has been restricted, JobScheduler can be deferred and Android 9 introduces the concept of "standby buckets".) Many developers have abused these APIs to do insane things for which a better (battery-friendly) solution would have existed. However, all these restrictions make it a very hard job to implement a safety-critical application that is governed by legal regulations, that must provide reliability guarantees and therefore requires line-monitoring of an unreliable network.
All the power management mechanism do not seem to consider safety-related scenarios. The user has no intent to use the app (which is perfectly fine) and no news are good news in this particular case. I.e. the app simply stays in the background. Unfortunately, the app is categorized into the standby bucket for "rare" apps and the app gets penalized which is not good.
android push-notification firebase-cloud-messaging watchdog android-background
add a comment |
According to FCM documentation high-priority messages might become de-prioritized, if the FCM server detects a pattern in which high-priority messages do not result into user interactions. The details of this mechanism are left unspecified. Questions:
- How exactly does this work?
- How does the detection algorithm gathers the data?
- For how long are messages de-prioritized?
Secondly, the Android app has a method that checks how old the most recently received message is. This methods sometimes reports wrong results, if messages with normal priority have not been delivered yet but are still cached at the FCM server. Question:
- How can make the Android app to fetch all messages first?
Some optional background information:
I am writing a monitoring app for some safety critical application. The on-premise server can be in one out of two mutually exclusive states: "idle" or "alarm". The state is sent via FCM to all registered clients. To ensure that the server is still running, the state is periodically broadcasted as a heartbeat. These heartbeat messages are sent with normal priority. Moreover, whenever the state changes from "idle" to "alarm" an additional, offbeat message with high priority is sent immediately. E.g. the sequence of messages is something like
... idle idle idle *alarm* alarm alarm alarm idle idle ...
As the first alarm message in a row triggers a notification and all other messages have only normal priority, there is (hopefully) no risk of being de-prioritized by FCM.
The Android app incorporates a PeriodicWorkRequest
that serves as a watchdog and checks if the heartbeat is still coming in. If the most recently received message is too old (older than 30mins), a "Connection lost" notification is displayed to the user to warn him.
Here is the problem:
The usual heartbeat messages have normal priority and are cached at the FCM server. The watchdog raises a false "connection lost" notification. The device is woken up (due to the notification) and suddenly the most recent heartbeat message comes in (they are collapsed at the server).
I see two solutions (or workarounds):
Make all messages high-priority messages, so that they are delivered immediately and the watchdog always sees the most recent message. However, I fear that the FCM de-prioritization algorithm kicks in. (99,95% are boring "idle" messages)
Before the watchdog checks the time of the latest message and eventually raises a warning, I have to ensure programmatically that all messages have been fetched.
Side note:
I totally understand why Google is enforcing more and more restrictions on background executions and asynchronous tasks. (Broadcast receivers have become more or less useless, AlarmManager has been restricted, JobScheduler can be deferred and Android 9 introduces the concept of "standby buckets".) Many developers have abused these APIs to do insane things for which a better (battery-friendly) solution would have existed. However, all these restrictions make it a very hard job to implement a safety-critical application that is governed by legal regulations, that must provide reliability guarantees and therefore requires line-monitoring of an unreliable network.
All the power management mechanism do not seem to consider safety-related scenarios. The user has no intent to use the app (which is perfectly fine) and no news are good news in this particular case. I.e. the app simply stays in the background. Unfortunately, the app is categorized into the standby bucket for "rare" apps and the app gets penalized which is not good.
android push-notification firebase-cloud-messaging watchdog android-background
According to FCM documentation high-priority messages might become de-prioritized, if the FCM server detects a pattern in which high-priority messages do not result into user interactions. The details of this mechanism are left unspecified. Questions:
- How exactly does this work?
- How does the detection algorithm gathers the data?
- For how long are messages de-prioritized?
Secondly, the Android app has a method that checks how old the most recently received message is. This methods sometimes reports wrong results, if messages with normal priority have not been delivered yet but are still cached at the FCM server. Question:
- How can make the Android app to fetch all messages first?
Some optional background information:
I am writing a monitoring app for some safety critical application. The on-premise server can be in one out of two mutually exclusive states: "idle" or "alarm". The state is sent via FCM to all registered clients. To ensure that the server is still running, the state is periodically broadcasted as a heartbeat. These heartbeat messages are sent with normal priority. Moreover, whenever the state changes from "idle" to "alarm" an additional, offbeat message with high priority is sent immediately. E.g. the sequence of messages is something like
... idle idle idle *alarm* alarm alarm alarm idle idle ...
As the first alarm message in a row triggers a notification and all other messages have only normal priority, there is (hopefully) no risk of being de-prioritized by FCM.
The Android app incorporates a PeriodicWorkRequest
that serves as a watchdog and checks if the heartbeat is still coming in. If the most recently received message is too old (older than 30mins), a "Connection lost" notification is displayed to the user to warn him.
Here is the problem:
The usual heartbeat messages have normal priority and are cached at the FCM server. The watchdog raises a false "connection lost" notification. The device is woken up (due to the notification) and suddenly the most recent heartbeat message comes in (they are collapsed at the server).
I see two solutions (or workarounds):
Make all messages high-priority messages, so that they are delivered immediately and the watchdog always sees the most recent message. However, I fear that the FCM de-prioritization algorithm kicks in. (99,95% are boring "idle" messages)
Before the watchdog checks the time of the latest message and eventually raises a warning, I have to ensure programmatically that all messages have been fetched.
Side note:
I totally understand why Google is enforcing more and more restrictions on background executions and asynchronous tasks. (Broadcast receivers have become more or less useless, AlarmManager has been restricted, JobScheduler can be deferred and Android 9 introduces the concept of "standby buckets".) Many developers have abused these APIs to do insane things for which a better (battery-friendly) solution would have existed. However, all these restrictions make it a very hard job to implement a safety-critical application that is governed by legal regulations, that must provide reliability guarantees and therefore requires line-monitoring of an unreliable network.
All the power management mechanism do not seem to consider safety-related scenarios. The user has no intent to use the app (which is perfectly fine) and no news are good news in this particular case. I.e. the app simply stays in the background. Unfortunately, the app is categorized into the standby bucket for "rare" apps and the app gets penalized which is not good.
android push-notification firebase-cloud-messaging watchdog android-background
android push-notification firebase-cloud-messaging watchdog android-background
edited Nov 23 '18 at 21:14
user2690527
asked Nov 23 '18 at 15:55
user2690527user2690527
287320
287320
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449674%2fhow-and-on-what-condidtions-are-fcm-high-priority-messages-de-prioritized-how-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449674%2fhow-and-on-what-condidtions-are-fcm-high-priority-messages-de-prioritized-how-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown