Is it possible display a banner for ios when receiving push notification while app is in foreground? - apple-push-notifications

Currently my app can receiving push notification and display a banner when receiving a push notification while the app is in background.
But however when my app is in foreground, there is no banner showing up. I look in the log and I found out that I can receive push notification (i print out the payload).
Any way to display a banner while in app? Or is it a limitation?
I am using the Appcelerator Ti.Network.registerForPushNotifications for push notification.

This is not a limitation of Titanium.
Apple doesn't allow to show notification banner when app is in foreground.
All you can do is to create and animate a manual view when your Push callback is called in foreground state.

Related

Xamarin Forms Push notifications not received properly when the app is closed in android

We have configured push notifications in our Xamarin Application for both android and iOS. In iOS notifications are being received properly. But in Android, specifically when the app is closed the notifications are not being received properly.
When the app is open, push notification is triggered and displayed properly as expected, can be observed in the screenshot attached.
When the app is closed, push notification is triggered and displayed as "body", can be observed in the screenshot attached.
Note* Notifications are being sent from ASP.net core with Azure Notifications hub.
The payload looks like below : new JObject(new JProperty("notification", pushMessage)).ToString(Formatting.None);
Andoid Notifications
I tried changing notification payload in different ways but still result didn't change.

iOS 11 push notification banner now shown while app in foreground

In doing some testing on the iOS 11 preview, I've noticed that when I get push notifications while my app is foregrounded the OS displays the system notification that you normally only see when your app is not active.
I didn't see anything announced as having been changed, or any new APIs to change this behavior one way or another. Does anyone know or have links to documentation stating if this is intended, a bug, temporary, or what?
There's an option for showing Push Notifications in the foreground in UserNotification framework.
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
Quoting the comment from the Framework:
The method will be called on the delegate only if the application is in the foreground. If the method is not implemented or the handler is not called in a timely manner then the notification will not be presented. The application can choose to have the notification presented as a sound, badge, alert and/or in the notification list. This decision should be based on whether the information in the notification is otherwise visible to the user.
This could be the place to start looking for the answer.

Simulating Apple Watch background push notifications PushNotificationPayload.apns

I can successfully use the PushNotificationPayload.apns file to simulate a push notification in the simulator but it simulates a foreground UIUserNotificationActionBehaviorDefault notification.
How can I simulate a background notification with an action behavior of UIUserNotificationActionBehaviorTextInput?

Display the push notification ios only if it for the user saved category inside app

I have created a shopping cart IOS app where the user can save Categories for which they are interested in (saved inside app localstorage). Now, whenever the admin is adding any product, I am sending the push notification from the server.
My question is how should i handle push notification, so that when my push notification will arrive on an ios device, it will check using APN PAYLOAD that if this product is from the user saved interested categories (saved inside app localstorage) and then display the push notification to the user, else the push notification will be ignored.
Can someone please tell me how to handle this exactly??
P.S - I am aware of the Silent Push Notifications and Push Notifications in IOS, the only problem is you can use the silent push notification for some app processing but again let's say if I send a Push Notification for an added product in cart, and when the app will receive the silent push notification and after code processing how I can again display the push notification again if the push notification is for the user interested category???

handling push notification while app is running in background

I have implemented push notification in my app and it works fine when the app is not running. But when my app is send to background then no alert is being displayed regarding the push notification. What do I need to do so even if my app is in background I can display alert for push notification.
Any help would be appreciated.

Resources