Admin notices are not shown in save post hook with wp5

When saving the post, admin notices is not shown.

Simplified code:

Admin notices are shown during initializing of plugin.

What am I doing wrong? Any ideas? TIA!

It has worked perfectly with WP4.