Christine
Christine

Reputation: 629

iOS Push - display message if app is active

I'm implementing Push in a Xamarin Forms PCL project, and I'm having an issue with iOS.

If the user is actively using the app I want to display an alert to let them know they have received a notification and let them choose to View it (which changes the current page) or cancel.

If the app is not active, either in the background or not running, I want to go directly from the tap on the iOS notification to the notification page - no alert. I have this working if the app is not running.

If the app is running, either in the background or active, the RecievedRemoteNotifications function is called which will display the alert. I don't see a way in RecievedRemoteNotification to determine if the app was already active or if the user tapped the system-generated notification.

Upvotes: 0

Views: 658

Answers (1)

Sulli
Sulli

Reputation: 401

Check out the ApplicationState property from UIApplication.SharedApplication.

More information about the possible values here. There is a Background state.

Upvotes: 1

Related Questions