iOS push notification problems when device is locked or app is minimized/closed

124 views
Skip to first unread message

Mario Barón

unread,
Oct 9, 2014, 1:51:49 PM10/9/14
to codenameone...@googlegroups.com
Hey guys

I think I put this before on another thread a while ago, but I can't seem to find it. What I found out is that push notifications aren't processed by the app when the device is locked or the app is minimized or closed. The push is only processed by the app once I click on the notification in the notification bar otherwise it just stays there as if the push had never arrived. 

This only happens on iOS devices (so far I have tried it on an iPhone with iOS 7). I attach two files with logs that I collected while reproducing this problems, maybe they could be of some help to finding the problem or maybe you see something else that I'm not seeing there.


Thanks.
Push notification iPhone app is closed.txt
Push notification while iPhone is blocked.txt

Shai Almog

unread,
Oct 9, 2014, 7:55:13 PM10/9/14
to codenameone...@googlegroups.com
Hi,
I see the Received notification while running which is a printout we make.
Its hard to understand from the printout what is happening when.

Marc M

unread,
Oct 10, 2014, 3:52:43 AM10/10/14
to codenameone...@googlegroups.com
I can confirm the behavior on iOS.
The push callback is executed only if the app is running in foreground while a notification arrives, or when the user taps on the notification in the notification center.
Pending notifications are not processed like on Android.
I think this behavior is due to iOS design of notifications.

Mario Barón

unread,
Oct 15, 2014, 8:38:08 AM10/15/14
to codenameone...@googlegroups.com
Hey Shai,

have you been able to take a look at this bug? maybe the logs I provided aren't of much help but the problem is still there and it seems to be happening with every push notification on iOS on those particular cases mentioned.

Thanks.

Shai Almog

unread,
Oct 15, 2014, 8:28:55 PM10/15/14
to codenameone...@googlegroups.com
Hi,
you didn't answer my question above. I see the push message coming in on one of the logs. Is it because you generated the log and then opened the app?

Mario Barón

unread,
Oct 16, 2014, 8:56:57 AM10/16/14
to codenameone...@googlegroups.com
Hey Shai,

the exercise I did are as follows, the log was taken during the entire process I did this:

case 1 app is closed: 
  • I closed my app completely (via swiping it from the opened apps drawer) 
  • Sent a push message to my app
  • Entered the app
  • The push wasn't processed

Case 2 device is locked:
  • Lock the device
  • Send push to the app
  • Unlock device (by swiping to unlock not by tapping on the push notification)
  • Push is not processed
  • Tap on the push notification at the notification bar
  • Push is processed
                                

 

On Thursday, October 9, 2014 12:51:49 PM UTC-5, Mario Barón wrote:

Shai Almog

unread,
Oct 16, 2014, 9:51:10 PM10/16/14
to codenameone...@googlegroups.com
Hi,
Was the push never processed in case 1? I see it arriving in the logs.

Can you send me a log with the app completely closed and without every launching it?

Also make sure to do a Log.p() in the push method for something like ****push method reached.

Mario Barón

unread,
Oct 29, 2014, 3:42:35 PM10/29/14
to codenameone...@googlegroups.com
Hey Shai,

I don't have an iOS device at hand so I can't generate a new log but on both cases as I said before, the push notification isn't processed until I click on the message on the notification bar, otherwise they're  never processed by the app. 

I've changed all System.out.println calls to Log.p and no new information was printed out. Can you please try to reproduce this cases with the information given through this posts, I don't have complete access to an iOS device and this bug is pretty serious.

Thanks. 


On Thursday, October 9, 2014 12:51:49 PM UTC-5, Mario Barón wrote:

Shai Almog

unread,
Oct 29, 2014, 9:48:52 PM10/29/14
to codenameone...@googlegroups.com
We'll take a look at this but this might take a while since we have our hands full here. I'm not sure if this is fixable though.

Mario Barón

unread,
Nov 11, 2014, 10:34:49 AM11/11/14
to codenameone...@googlegroups.com
Hey Shai,

have you been able to get a look at this? Some people have been really complaining about this on my app.




On Thursday, October 9, 2014 12:51:49 PM UTC-5, Mario Barón wrote:

Shai Almog

unread,
Nov 12, 2014, 12:20:17 AM11/12/14
to codenameone...@googlegroups.com
Hi,
this seems to be a limitation prior to iOS 7. In iOS 7 there is a new mechanism to allow background push but activating it isn't simple since the "JVM" isn't running in the background (e.g. no gc etc.)
We can look at this for the new VM but right now the priority is to get the new VM stable before adding features.

vix...@gmail.com

unread,
Jan 22, 2016, 4:40:02 PM1/22/16
to CodenameOne Discussions

Hello,

Any news on this issue, I have the same problem with iPhone 5S with iOS 9.1  

thanks in advanced.

Shai Almog

unread,
Jan 23, 2016, 1:35:10 AM1/23/16
to CodenameOne Discussions, vix...@gmail.com
iOS doesn't allow "real" background push like Android does. That's a native limitation.
See https://www.codenameone.com/blog/building-a-chat-app-with-codename-one-part-6.html

neilc...@gmail.com

unread,
Jan 29, 2016, 10:39:51 AM1/29/16
to CodenameOne Discussions
Hi Mario,

We are looking for a Codename One freelance developer for a 2-3 month contract for a personal fitness MobileApp with a twist.  If you'd like more information please contact me through the gmail hangouts/circles request.

Regards, Neil
Reply all
Reply to author
Forward
0 new messages