It's possible, the steps will vary between phones. The "Do Not Disturb" feature might be the easiest way:
https://support.google.com/android/answer/9069335
Android 9 and up
Change your interruption settings
- Open your phone's Settings app.
- Tap Sound & vibration > Do Not Disturb. If you see "Do Not Disturb preferences" instead, you're using an older Android version.
- Under "What can interrupt Do Not Disturb," choose what to block or allow.
- People: Block or allow calls, messages, or conversations.
- Apps: Choose which apps can send you notifications.
- Alarms & other interruptions: Block or allow alarms, media, touch sounds, reminders, or calendar events.
- To turn Do Not Disturb on or off, swipe down from the top of your screen. Then tap Do Not Disturb
Tip: With any settings, critical notifications show. For example, you can't block system security notifications.
Android 8 or below
Option 3: Priority notifications only
Important: This won't mute sounds from music, videos, games, or other media.
- Pick which notifications are a priority.
- Open your phone's Settings app.
- Tap Sound > Do Not Disturb preferences > Priority only allows.
- Set your priorities.
- Turn on "Priority only."
- Swipe down from the top of your screen with 2 fingers.
- Under Do not disturb or your current option, tap the Down arrow.
- Turn on Do not disturb.
- Pick Priority only.
- Choose how long you want this setting to last.
- Tap Done. You'll see Priority only.