Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-30-2010, 03:18 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default Handling remote notifications when opening the app from the background?

Hey guys,

There is no documentation on how to handle a remote notification when the application is running in the background (iOS4).

It seems like there is no way to know that the application entered the foreground from a remote notification.

Does anyone know more on the subject?
chrysb is offline   Reply With Quote
Old 07-01-2010, 04:08 AM   #2 (permalink)
Registered Member
 
rapidrabbit's Avatar
 
Join Date: Nov 2009
Posts: 36
rapidrabbit is on a distinguished road
Default

I would like to hear about that, too. My users are complaining that the icon badge never gets removed on their iOS 4 device - is this working as designed or a bug?

They have to close the app manually to get rid of the badge - is there something I can do to remove the badge, when the app goes to background?
__________________
Visit our blog!

Our apps:
- AppButler - a new way to discover the AppStore
- yukendo - Sudoku / KenKen game
- Pomodoro Time Management - the app for the pomodoro technique
rapidrabbit is offline   Reply With Quote
Old 07-01-2010, 01:52 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default

Quote:
Originally Posted by rapidrabbit View Post
I would like to hear about that, too. My users are complaining that the icon badge never gets removed on their iOS 4 device - is this working as designed or a bug?

They have to close the app manually to get rid of the badge - is there something I can do to remove the badge, when the app goes to background?
Just set the badge to 0 in

Code:
- (void)applicationWillEnterForeground:(UIApplication *)application
chrysb is offline   Reply With Quote
Old 07-08-2010, 12:45 PM   #4 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default

Does anyone have any insight on this? It's ridiculous. You can't tell that the app entered the foreground via push/local notification.
chrysb is offline   Reply With Quote
Old 08-01-2010, 07:43 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default

Does anyone know if there are any developments on this front?
chrysb is offline   Reply With Quote
Old 08-23-2010, 08:06 PM   #6 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default

Has anyone shed any light on this?
chrysb is offline   Reply With Quote
Old 08-23-2010, 11:54 PM   #7 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

I'm unclear about the problem. If you are handling the notification, doesn't that mean you are in the foreground?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-16-2010, 01:59 PM   #8 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
I'm unclear about the problem. If you are handling the notification, doesn't that mean you are in the foreground?
If your app is in the background and you receive a push notification and the user taps "View", it brings the application to the foreground.

When that happens, only applicationDidEnterForeground is called, and there is no way to access the payload of the push notification.

Before multitasking, it would call applicationDidFinishLaunchingWithOptions and that would include the remote notification information.

Am I missing something here?
chrysb is offline   Reply With Quote
Old 09-16-2010, 02:06 PM   #9 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Only other relevant method I see is application: didReceiveRemoteNotification:
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-16-2010, 05:04 PM   #10 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 102
chrysb is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Only other relevant method I see is application: didReceiveRemoteNotification:
Yeah, and I verified, that does not get called when the app is in the background.

So, what I'm saying is, remote notifications don't work with multitasking, which is a mega, mega fail.

It's really broken our app :/

Thanks for taking a look, though!
chrysb is offline   Reply With Quote
Old 09-16-2010, 06:07 PM   #11 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

You probably should post in the Apple developer forums.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 08-14-2011, 01:20 AM   #12 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 7
n8r0n is on a distinguished road
Default Apple Docs

I don't know if something isn't functioning as intended, but this Apple document:

Local and Push Notification Programming Guide


Says this:

Quote:
In iOS, you can determine whether an application is launched as a result of the user tapping the action button or whether the notification was delivered to the already-running application by examining the application state. In the delegate’s implementation of the application:didReceiveRemoteNotification: or application:didReceiveLocalNotification: method, get the value of the applicationState property and evaluate it. If the value is UIApplicationStateInactive, the user tapped the action button; if the value is UIApplicationStateActive, the application was frontmost when it received the notification.
So, [UIApplication applicationState] is the important property. The document discusses payload, too.

I just tested on my 4.3.3 device, and application:didReceiveRemoteNotification most definitely is getting called for me.
n8r0n is offline   Reply With Quote
Old 02-04-2012, 04:21 AM   #13 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 1
NoCode is on a distinguished road
Default

Quote:
Originally Posted by n8r0n View Post
I don't know if something isn't functioning as intended, but this Apple document:

Local and Push Notification Programming Guide


Says this:



So, [UIApplication applicationState] is the important property. The document discusses payload, too.

I just tested on my 4.3.3 device, and application:didReceiveRemoteNotification most definitely is getting called for me.
I'm sorry for gravedigging this post.

I have the same problem proposed here:
- open app
- put it in background
- receive a remote notification
- tap on icon of the app
- nothing showing

IF i tap directly on the notification i get all working great, but if i tap on the app icon nothing will be shown about my notification.

Is there a solution to this? Thank you.
NoCode is offline   Reply With Quote
Old 02-26-2012, 03:53 PM   #14 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 46
NorthCode is on a distinguished road
Default

Quote:
Originally Posted by NoCode View Post
I'm sorry for gravedigging this post.

I have the same problem proposed here:
- open app
- put it in background
- receive a remote notification
- tap on icon of the app
- nothing showing

IF i tap directly on the notification i get all working great, but if i tap on the app icon nothing will be shown about my notification.

Is there a solution to this? Thank you.
I really need this too. Bump. How can the app still register the notification even though the notificaton wasnt pressed?
NorthCode is offline   Reply With Quote
Old 02-26-2012, 04:23 PM   #15 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

If the app was in the background at the time, and the user did not choose to view it within your app, then at next launch your app should talk to the server to find out about any missing notifications. It's not something the app can do alone.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 02-26-2012, 06:09 PM   #16 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 46
NorthCode is on a distinguished road
Default ..

Ok, got it. It introduces need for more server-side management, but it is probably healty anyways.
NorthCode is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 328
7 members and 321 guests
anothermine, Chickenrig, Domele, givensur, michaelhansen, PixelInteractive, Sloshmonster
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,892
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:24 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0