Skip to content
Advertisement

Getting a failed to post notification on channel “channel_id_here” error

I have been struggling for days now to get local notifications to display on an Android device. Notifications simply do not show up and I’m getting a developer warning:

JavaScript

I went through many tutorials and StackOverflow posts to see if there’s anything I missed, but I simply can’t find it. Can someone please take a look if I did something wrong here or if there’s something I’m missing. I would appreciate some assistance in sorting this out.

My app is targeting API 29 and I used code from this git

Here is the relevant code from my app:

AppCompatPreferenceActivity.java

JavaScript

NotificationPublisher.java

JavaScript

NotificationSchedulerApplication.java

JavaScript

SettingsActivity.java

JavaScript

TimePreference.java

JavaScript

The receiver in my AndroidManifest.xml:

JavaScript

I can set the time in my app and notifications are enabled for the app on the device. They simply don’t display.

Note: I am developing with Android API 29.

Advertisement

Answer

In the sample app, in NotificationSchedulerApplication:

JavaScript

The bit in the AndroidManifest.xml that causes onCreate to be called in the Application followed by createNotificationChannel is this:

JavaScript

onCreate in the Application should be called every time you do: Run -> Debug

Just click on the left of createNotificationChannel() to set a breakpoint.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement