1
votes

I developed a chat app using XMPP it works fine while app is in foreground and until 3 min in background after 3 min in background app does not receives messages in short it gets disconnected i also use this xmppStream.enableBackgroundingOnSocket = YES; but its works only if app is alive in background. Using VoIP it works fine but my app isn't VoIP supported which may cause rejection from app store. I was thinking of playing silent music in background to keep app alive in background but i doubt of rejection. I tried using UIBackgroundTaskIdentifier task but iOS still kills app in 3 mins. I tried using Background Fetch but that doesn't keep app alive.

  • Anyone has idea about this?
  • Is it okay to play silent music in background?Will app store reject my app if i do so?
  • I looked at many posts they says remote notification is an option, is it really so? Can we achieve this without remote notification?
1
brother i think you will need to GCM(Google Cloud Messaging) for the application.Hitesh Surani
can i achieve without using GCM/Remote Notification?Pratik Jamariya
understand first thing clearly.we don't have any Commands after the Application goes into the Background, if we want execution of some code in background or terminate state then we must implement GCM/Remote NotificationHitesh Surani
@PratikJamariya you can try with APNS i think this is usefull for you..Raju

1 Answers

1
votes

You cannot achieve this functionality without PushNotification.

Even WhatsApp implements push notification for sending message when app is not in foreground mode.

You can check it by looking into delivery/read ticks when receiver of the message is not in foreground.

Keeping the Socket Alive is not way to implement this functionality as it will drain your iPhone's battery.