Local notifications when the game is foremost and visible

I am using the LocalNotifications mechanism to schedule notifications that should appear after a specified interval.
The feature works fine, and I get the notification on time.

My problem is that if the game is visible, I still get the local notification, which is not my desirable behaviour.
I want the notification to appear only when the game is in the background.

I didn’t see any setting in Unity for this (maybe I missed) and was thinking maybe I should change some native code.
Anyone can help here?

What I do is cancel all scheduled notifications when my app starts/gets focus and schedule new notifications when my app loses focus.