Push notification is not working when app is opened - iphone

I have an issue with my app's push notification on ios 7, it works when app in back ground or remove it from dock. But push messages DO NOT work (not appearing) when the app screen comes to foreground.
But it was fine with iOS 6. Any change require in coding or storyboard settings?

When PushNotification is arrive it calls didReceiveRemoteNotification method when app is in foreground.
And when your app is not in foreground it will send to Notification Center, and if user tap on notification from notification center then it will call didReceiveRemoteNotificationmethod.

//According to Apple Push notification Document.
Push notifications serve much the same purpose as a background application on a desktop system, but without the additional overhead. For an application that is not currently running—or, in the case of iOS, not running in the foreground—the notification occurs indirectly.
Check Link :)

Related

How do i set up foreground notifications in flutter app?

I am sending notifications from firebase.
Background notification works fine but I can't find something that worked in foreground for me.
I want to display the notification when the app is open same as when the app is in background.
with system notification sound and same banner display at the top of screen.
You can control this on iOS
FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(badge: true, alert: true, sound: true);
package:firebase_messaging/firebase_messaging.dart
Sets the presentation options for Apple notifications when received in
the foreground.
By default, on Apple devices notification messages are only shown when
the application is in the background or terminated. Calling this
method updates these options to allow customizing notification
presentation behaviour whilst the application is in the foreground.
Important: The requested permissions and those set by the user take
priority over these settings.
[alert] Causes a notification message to display in the foreground,
overlaying the current application (heads up mode). [badge] The
application badge count will be updated if the application is in the
foreground. [sound] The device will trigger a sound if the application
is in the foreground. If all arguments are false or are omitted, a
notification will not be displayed in the foreground, however you will
still receive events relating to the notification.

Local User Notification action tapped on watch not delivered to iOS app

I have an iOS 10 app and watchOS 3 extension that uses iOS 10 User Notifications Framework. The local notification is scheduled from the iOS app, and is shown on the watch when the iPhone is locked, and shown on the iOS app on the lock screen if I raise my iPhone, and don't respond to the watch. The iOS notification have three background action buttons.
If I respond to the notification on my iPhone, the userNotificationCenter(_:didReceive:withCompletionHandler:) UNUserNotificationCenter delegate method is called correctly. But if I instead tap on one of the action buttons on my watch, the function is not called.
According to Apple's App Programming Guide for watchOS, under the section Responding to Selected Actions:
For background actions, the handling of actions depends on where the notification was scheduled:For local notifications scheduled on iPhone, background actions are handled by your iOS app regardless of which device displayed the notification.
This is not happening, and I don't know why. Have anyone got this working from the watchOS?
It looks like I didn't put the correct options in the UNNotificationAction. The options should be an empty array, instead of the .foreground I had mistakenly put there.
So for e.g. the Just Practice button, the correct action for it to be background is:
let justPracticeAction = UNNotificationAction(identifier: "justPractice", title: "Just Practice", options: [])

Wrong app icon on push notification badge iphone

I have implemented push notifications for my iPhone application. Everything is working fine. Only problem is when I receive notification during app is in background the iOS notification shows wrong icon for the notification. Like if notification came for App A it shows the icon of App B in notification badge.
What can cause this? Is it certificates problem or what? Any idea?
if you have some images name like "icon.png", that will be displayed in push notification
Few more thing can cause this issue,
If you have used same push profile for two different project. Than also this will happen.
Moreover if you have specified Small-Icon.png in you .plist file than that would be used as a push notification icon in notification screen.
Please make sure this things in your projects.

iOS add notification to the lockscreen that will not disappear

is it possible to add a notification to the lockscreen that will not disappear?
or (my second choice)
Is it possible to add a notification to the lockscreen, which will be thre until the iPhone is unlocked the next time?
For example:
iPhone is unlocked
message incoming
lock iPhone
message is in lockscreen
unlock iPhone
message is not longer in lockscreen
Edit:
My goal is to have a notification on the lockscreen every time.
No, neither is possible. If your app is in foreground, it gets delivered to your app directly and is not displayed. If the screen is locked or you app is in background, the notification is shown.
in ios5 there is a new feature in notification that notifications are automatically shown in the lockscreen if the user select the option from the setting but your app cannot receive any notification if your app in foreground.

Is it possible to receive push notifications in background mode

Is it possible to receive all push notifications that app recieved in background mode.
I mean that when app runned and then app went to background mode and then app recieve push notifications(in background mode) and user does not press view button on alert message (this button run app) and after some minutes user launch app, in this point I want get all push notifications that my app recieve in background mode.
Yes, applications can and do receive Push Notifications whether they are backgrounded or not even active. In your applicationDidEnterBackground: method you can check to see if your app has received a notification, then handle it from there.