xialin
xialin

Reputation: 7756

iOS Push Notification - check if the banner is showing when app is in background

I have a VoIP app, where the incoming call notification is very important.

The problem is, sometimes I don't get the push notification (even Apple said it's not guaranteed). But, I do have a mechanism to notice that an call is coming while the app is in the background.

So, what I want to do is.. still use Push Notification as the main handler for incoming call (because it handles the situation when app is closed). However, if the push notification failed to deliver and my app gets the call invite, I will raise a local notification, telling user that you have an incoming call.

My question is... how can I check if a notification is showing before I decide whether to fire a local notification?

Upvotes: 0

Views: 359

Answers (2)

Noah Witherspoon
Noah Witherspoon

Reputation: 57149

There’s no API to get any information about the state of your notifications. Since you’re making a VoIP app, you have the option to have it get woken up for incoming data, which would let you post your “incoming call” notification whenever you need it—see the “Configuring Sockets for VoIP Usage” section here.

Upvotes: 1

Yogi
Yogi

Reputation: 3588

AFAIK you can only detect the notification when the user taps on the banner OR if the app is open when the notification comes. So I can't see a way to detect if the notification has come yet or not. Just adding to the pain, push notification is famous for its unreliability.

Upvotes: 2

Related Questions