Work in the background in XMPP

I am working on XMPP. I want to get a notification in the background. And I also implement this,

- (void)xmppStream:(XMPPStream *)sender socketWillConnect:(GCDAsyncSocket *)socket { // Tell the socket to stay around if the app goes to the background (only works on apps with the VoIP background flag set) [socket performBlock:^{ [socket enableBackgroundingOnSocket]; }]; } 

in my code, I set the VOIP flag in the background of the application plist file. In this mode, my application can fully run in the background. But the apple rejects this path.

So. I think APNS (Push Notification) is another way, but in my application there are huge chat users, how can I handle the mess using Push Notification?

And one more thing, can I set the quiet sound in the background and set the background mode? so any problem or problem with the replica on the apple side?

So give me the right idea and suggestion for this question.

Thanks x in Advance.

+5
source share
3 answers

And one more thing, can I set up a quiet audio file in the background and set the background mode? thus, any problem or problem of deviation from the side of the apple?

Therefore, Apple rejects the application.

To notify the use of a received message, you must use local notification for the background and foreground state of the application and use push notification for the inactive state of the application.

To achieve your goal, using any background mode is not a solution.

+2
source

How to process messages using push notification?

You need to check if the user is connected to the XMPP server or not. If the user is connected to XMPP, go over the XMPP protocol; if the user is not connected to XMPP, send a push notification that will help the user to appear on the network and receive messages.

And one more thing, can I set up a quiet audio file in the background and set the background mode? thus, any problem or problem of deviation from the side of the apple?

Yes, the apple will reject the application (designed to cheat Apple)

+2
source

When your background / kills application, send a web service to the server at this time, which can tell you are offline.

Then after the sever can send you a push notification, the entire contents of the chat.

0
source

Source: https://habr.com/ru/post/1247002/


All Articles