0

I'm building a mobile chat app. I've configured OneSignal to send push notifications to my iOS device.

I plan to send push notifications to the user when a new message is received and the application isn't in the foreground (similar to how Facebook Messenger works).

I'm new to push notifications. I can imagine two solutions, neither of them elegant:

Solution 1: Send a push notification every time a message is sent. Then, if the app is open, ignore/swallow the notification. (Seems like a waste of resources).

Solution 2: Keep track of the app's state in my own database and only send a push notification if the app isn't in the foreground. (Seems overly complex).

What am I missing? What is the correct way to handle this?

Scott
  • 863
  • 9
  • 12

0 Answers0