Please provide the following:
- SDK Version: 42
- Platform: Android
I have run into an issue setting the badge count for my standalone Android app (through Internal testing). The intention was to set up a background fetch task to query the server for information from which I can derive a notification count which I set to the badge. I’ve since removed most of the complexity and narrowed the issue to the setting of the badge count itself. Through some extra logging I have been able to determine
- the task is running (around each minute or two)
- the result of setBadgeCountAsync is true
- after I set the badge count when I query for the badge number with getBadgeCountAsync, I get the value which I set (1 in this case).
The only problem is that the app icon on the home screen does not show any badge number. For context, I’m running on a Samsung Galaxy Note 20 Ultra with the Samsung launcher. When I search through settings for the app I can see that badge Icons are enabled. Does anyone have an idea what
could be happening?
Relevant code:
TaskManager.defineTask(BACKGROUND_FETCH_TASK, async () => {
try {
const user = await GLOBAL.getCurrentUser();
if (user.role !== 'PATIENT') {
await Notifications.setBadgeCountAsync(1);
return BackgroundFetch.Result.NewData;
} else {
await updateTestLogs('no fetch needed')
return BackgroundFetch.Result.NoData;
}
} catch (error) {
Bugsnag.notify(error);
return BackgroundFetch.Result.Failed;
}
})
;