Bad notification posted – Couldn’t expand RemoteViews for: StatusBarNotification

For me, the problem was that I was setting a specific height for the root layout, in the custom notification view xml file. As soon as I changed: android:layout_height=”@dimen/notification_expanded” to android:layout_height=”match_parent” in the root layout of notification view, the problem was solved. Also take a look at this example to see a simple example of … Read more

Failed to post notification on channel “null” Target Api is 26

From the developer documentation: When you target Android 8.0 (API level 26), you must implement one or more notification channels to display notifications to your users. int NOTIFICATION_ID = 234; NotificationManager notificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE); String CHANNEL_ID; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { CHANNEL_ID = “my_channel_01”; CharSequence name = “my_channel”; String Description = “This is my … Read more

How do I check whether my app is allowed to post notifications?

EDIT – New Answer: Seems like google added the proper API call: NotificationManagerCompat.from(context).areNotificationsEnabled() OLD ANSWER: For anyone who is looking at this question, note that NotificationListenerService is different from “Show Notification”. These two are different things! If an app has access to NotificationListenerService does not mean that its notifications are shown and vice versa. In … Read more

Cancel notification on remove application from multitask panel

Killing Notifications when main app has been killed. Since your notification and your app are handled in different threads killing your app via MultitaskManager won’t kill your notification. As you already correctly investigated killing your app won’t even necesarrily result in an onExit() callback. So what is the solutions? You could start a service from … Read more

NotificationChannel issue in Android O

As it is written in Android Documentation: https://developer.android.com/preview/features/notification-channels.html If you target Android O and post a notification without specifying a valid notifications channel, the notification fails to post and the system logs an error. To solve this issue you need to create a NotificationChannel. NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // The id of the channel. … Read more

Can NoticationManager.notify() be called from a worker thread?

It is acceptable to update a Notification from a worker thread because the Notification does not live in your application’s process and hence you are not updating its UI directly. The Notification is maintained in a system process, and the Notification‘s UI is updated through RemoteViews (doc), which allows the manipulation of a view hierarchy … Read more

Flutter: Push notifications even if the app is closed

For reminders i would recomend Flutter Local Notifications Plugin. It has a powerful scheduling api. From the documentation of local notification: Scheduling when notifications should appear – Periodically show a notification (interval-based) – Schedule a notification to be shown daily at a specified time – Schedule a notification to be shown weekly on a specified … Read more

tech