ios/xcode: Possible to send notification when app is in foreground (as alternative to alert)

144 views Asked by At

This may be contrary to HIG...it is not standard..but it occurred to me that after a user sends feedback from withinmy app, it might be nice to flash a quick unobtrusive message "Thank you for your feedback" or something. I don't want to hit the user with a full blown alert. But a discreet notification banner along the top might be nice.

Is it possible to do this or is it disallowed?

Thanks for any suggestions.

3

There are 3 answers

0
Fawad Masud On BEST ANSWER

Local notification will be received in this case but will not be displayed as you want it. However you can make a custom view similar to iOS view. Also please check https://github.com/OpenFibers/OTNotification

0
petershine On

Unless the notification is from other application in background,
your currently active app has every right and responsibility in interacting with user with any types of visuals.

There are no class from iOS SDK to allow you to use the same notification banner used for Push Notification. To achieve the same result while your app is active, you may need to adopt your own solution or a module.

0
Sheamus On

If this notification is initiated from an action from within your app, an Apple notification may not be necessary. You want to simply show a thank you message, so it doesn't even have to wait for a response from a server, but you may want to check if you have Internet connectivity, just to be able to say that the message couldn't be sent, and offer the option to retry.

These are good options for a Toast-style alert that Android uses and is unobtrusive:

  1. https://www.cocoacontrols.com/controls/toast
  2. https://github.com/scalessec/Toast

You can configure it to slide in from the top or bottom. And, it slides away without user interaction.