user3225917
user3225917

Reputation: 3021

Push notification like local notification when the app is already running on iOS?

I want to implement push notification like Yo when the app is already running.

I already wrote some codes for it but i found that it is not possible to show notification view when the app is already running.

How can I implement the notification view like local notification on the top not like alertview.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler {

    if (application.applicationState == UIApplicationStateActive) {
         hogehoge...
    }

    if (application.applicationState == UIApplicationStateInactive) {
    }

    if(application.applicationState == UIApplicationStateBackground) {
    } }

Upvotes: 0

Views: 841

Answers (1)

joelg
joelg

Reputation: 1094

I think this question has been asked many times, but the bottom line is that since your app is already running, you just handle push notifications a different way. You can show a custom notification view, or an alert view, etc. I know you don't want to show an alert view, so you could just create a custom view that appears as you'd like it to.

Here is another question along the same lines as yours:

iOS - Push notification alert is not shown when the app is running

Upvotes: 1

Related Questions