iOS Question Silent Push Notifications

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All,

I am looking to implement a reliable way to receive notifications when the app is closed.
I looked at the tutorial in the link below
https://www.b4x.com/android/forum/threads/silent-push-notifications.56016/

But when I read the statement below, it makes me wonder how do other apps such as Skype implement their notifications in iOS
iOS will not start the app automatically if the user has killed it. This makes it a bit difficult to test that it really works.


Thanks
iCAB
 

iCAB

Well-Known Member
Licensed User
Longtime User
I may have missed something as this thread is too long but I'm not sure what is the problem. It is expected that not all silent notifications will be received.
Hi Erel,

Sorry if the thread is too long, but I tried to give as much details as possible so I am not leaving anything out.
I am receiving the silent notifications for 10-15 seconds only after the app is sent to the background and then they stop coming.
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Make sure to run your app in release mode and don't kill it with a swipe.
Test it after 30+ minutes.

Hi Erel

Somehow I can't get this to work. Can you please let me know if there is anything more than this to get it going.

B4J Code

B4X:
#if NORMAL_PUSH_CODE 'This code works perfect for normal push
    Dim iosalert As Map =  CreateMap("title": "", "body": "open the message", "sound": "default")
    m.Put("notification", iosalert)
    
    m.Put("priority", 10)
    m.Put("time_to_live": 0)
'    m.Put("priority": "high")
#Else
    m.Put("priority", 10)
    m.Put("content_available", True)
#end if

B4I code
Is there any difference between normal and silent other than this line

B4X:
#PlistExtra: <key>UIBackgroundModes</key><array><string>remote-notification</string></array>


I should say, that I do receive one or two messages in the background then everything stops.

I have also noticed that sometimes I see the following output with iRelease logger

B4X:
+[CATransaction synchronize] called within transaction
+[CATransaction synchronize] called within transaction
+[CATransaction synchronize] called within transaction
+[CATransaction synchronize] called within transaction

Thanks in advance
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
The logs do not look relevant.
Your code looks correct. I guess that Application_RemoteNotification is not raised, right?

Hi Erel, sorry for the late reply, but somehow I didn't see your reply until today

Correct, it is not raised
 
Upvote 0
Top