How to know the app is invoked from background process or not

Thanks in advance.
I used push notification service in my application.If the app is running in background i am able get the alert view, but the app is in active state it is not displaying alert. Is there any way to display alert.
Actually to display alert i am creating an alert in - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo method.
But there is a problam with this alert ie, of the app is running in background we will get remote alert at the same time we will get this alert also.
So is there any way to find if the app is in active state or in background while receiving remote notification using didReceiveRemoteNotification method.


A simple solution I can think of is to make use of applicationDidBecomeActive: and applicationDidEnterBackground:. Declare a property in your app delegate and set it properly in those two methods. Then you can do anything you want based on this property, like [[[UIApplication sharedApplication] delegate] isInBackground].

链接地址: http://www.djcxy.com/p/67250.html

上一篇: 我可以获取有关通知(apn)的信息吗

下一篇: 如何知道应用程序是否从后台进程调用