Fuse Community

Android notifications not showing in tray after API 26 upgrade

Hello! I compiled my app for Android with API 27 and noticed that notifications are not coming to the tray anymore. API’s older than that work ok. The payload from the notification comes to the app, so the notification itself works, but doesn’t show up in the tray. I then read this from android.com: “Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel or it will not appear.”

How can I assign a channel in the payload/app to make the notification appear in the tray?

In Impl.uno I added (before notificationManager.notify):

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {

	String channelId = "app_channel_id";
	CharSequence channelName = "app_channel_name";
	int importance = android.app.NotificationManager.IMPORTANCE_DEFAULT;
	android.app.NotificationChannel notificationChannel = new android.app.NotificationChannel(channelId, channelName, importance);
	notificationManager.createNotificationChannel(notificationChannel);

}

But still the notification doesn’t appear in the tray. Any ideas?

try with IMPORTANCE_HIGH, by the way here’s the FCM update (Fuse 1.10): https://github.com/fuse-open/fuselibs/pull/1220

@aeq What changes need to be made for the notifications to be shown in Android 8.0 (API level 26) and above ? Just taking last version of fuselibs or something more ?
I read that notification channel need to to be created for Android 8.0 (API level 26) and above… How to create notification channel in fusetools for my app ?

If I remember correctly, its a channel at a minimum that is required, with my latest update to the push notifications, there are already defaults set, so you don’t have to do anything special. I updated the docs with my changes too, so you can read on the available properties/features here: https://github.com/fuse-open/fuselibs/blob/1792c481f3b7b7758a03060910b50978c6d35929/Source/Fuse.PushNotifications/Docs/Guide.md

Unfortunately, my pull request hasn’t been reviewed and accepted into fuselibs yet, so its not available with latest fuse release.

How you can use my version is by pointing your project to use a downloaded version of fuselibs, then override the Fuse.PushNotifications folder in the src with mine. Note, after any changes to that fuselibs, you will need to run uno doctor in your project dir. Here’s a tut you can follow: Oct 2018 - How to update to latest Fuselibs and Uno

You would just need fuselibs from step 1, step 3, overriding Fuse.PushNotifications with mine and step 5.

1 Like

@aeq Great! Where I can find your version of the Fuse.PushNotifications folder to replace the original one ?

PR: https://github.com/fuse-open/fuselibs/pull/1220
PR Files Changed: https://github.com/fuse-open/fuselibs/pull/1220/files

or via my branch: https://github.com/rbtech/fuselibs/tree/Push-Notifications/Source/Fuse.PushNotifications

@aeq One last question, did I need last version of fusetools(1.10.0) ? Now I have 1.8.2 Did I need to update it or be cause it is used fuselibs it is doesn’t matter the version of fusetools ?

You need 1.10 because new push requires firebase which requires new gradle.