QuickBlox: How to keep alive app in background? - xmpp

I am using QuickBlox SDk for chat app. When app goes to background mode, I could not receive chat messages. So I want to keep alive app in background mode.
I know the way to keep alive app in background for VOIP based app.
Also I got a useful link for XMPP to support background mode. But for that we need to interact with XMPP framework but with QuickBlox SDK we don't need to directly interact with XMPP frameworks.
So, What is the possible way to keep alive app in background using QuickBlox SDK ?

You will be online in XMPP while your device send XMPP presence.
[[QBChat instance] sendPresence];
After 90 seconds from last presence session is closed.
I think you can create background task with presence timer (but this will work for 10 minutes. After that time will spend you can try recreate background task for next 10 mins and etc., but I don't check if this work). This is Perform finite-length tasks from Ray's site.

Related

Phonegap background task

I'm developing an iOS phonegap application which receives messages from a node.js/socket.io server. Everything works fine except when the application is "suspended". The user must re-activate the application to see incoming messages. Alerts throw only when the application is active.
Is there any workaround to throw alert messages even if the application is suspended.
Thanks in advance,
After a long research and some tests, it seems that it is impossible to keep an application running on background if it does not track localisation, use voip, play music and a limited number of other scenarios... at least on iOS.
I'm going to use APNS instead.
On iOS 8 you can wake up the app with a notification or by a time interval and then e.g. performFetchWithCompletionHandler

Would Apple reject an app using sksmtpmessage framework to send e-mail in the background?

I'm thinking in making an app that send e-mails without showing the native iOS mail app. For that I'd be using sksmtpmessage framework.
I'd like as well to keep sending the e-mail when the app goes in background. According to this thread, it would be doable.
I know that Apple limits a few tasks to be done is the background (Audio, VoIP and location). Then my question is, would Apple reject an app using sksmtpmessage framework to send an e-mail from the background?
Cheers :)
If you're just "completing a task" (i.e. the user loads the app to send some e-mails, then quits before they're all sent), you're fine - that's what the Task Completion multitasking mode is for. If you want to run constantly in the background sending e-mail, then it'll almost certainly be a reject (if they spot it) - this isn't something they envisage being done on the iPhone.
From the app docs : An application can call the beginBackgroundTaskWithExpirationHandler: method to ask the system for extra time to complete some long-running task in the background. If the request is granted, and if the application goes into the background while the task is in progress, the system lets the application run for an additional amount of time instead of suspending it. (The backgroundTimeRemaining property of the UIApplication object contains the amount of time the application has to run.)
You can do preceding in time, because iOS 4 gives you a 10 mins of time for task completion after you exit an app.

How does skype remain on top when call is in process and you switch to other app in iPhone

what iOS feature does skype app use where it can remain on top of other apps with a drop down like bar even if you run other apps?
Skype uses the iOS 4 multitasking APIs, specifically VoIP multitasking in order to keep the call active while the rest of the app is suspended.
When the app is sent to the background, Skype informs the system that it would like to keep its network connection alive and that the audio subsystem should remain active.
The system continues to look after the network connection, passing received data back to Skype in order for it to process the audio.
This is one of the three main forms of multitasking in iOS, the others being: audio streaming, like Pandora and location services, like Tom Tom navigation.
It does this via the background execution APIs available starting in iOS 4. More information about how it works can be found in the Implementing a VoIP Application subsection on this page in the iOS Application Programming Guide.

iPhone Dev: Can you have a program running in background respond to SMS in iOS4+?

Can you have a program running in background respond to SMS? I basically want my program to sit in the background so the will be iOS4+ and when someone text messages you, the app can then do something with that text.
Can this be done?
I have seen that the question has been asked before, but it was before the iphone could have background apps.
No backgrounding is very limited on IOS. There is only a handful of stuff you can do. You can always send push notifications to get an alert while the app is not running in the foreground.
From Apple:
OS 4 delivers seven new multitasking services that allow your apps to
perform tasks in the background while
preserving battery life and
performance. These multitasking
services include:
Background audio - Allows your app to
play audio continuously. So customers
can listen to your app while they surf
the web, play games, and more. Voice
over IP - Your VoIP apps can now be
even better. Users can now receive
VoIP calls and have conversations
while using another app. Your users
can even receive calls when their
phones are locked in their pocket.
Background location - Navigation apps
can now continue to guide users who
are listening to their iPods, or using
other apps. iOS 4 also provides a new
and battery-efficient way to monitor
location when users move between cell
towers. This is a great way for your
social networking apps to keep track
of users and their friends' locations.
Push notifications - Receive alerts
from your remote servers even when
your app isn't running.
Local notifications - Your app can now
alert users of scheduled events and
alarms in the background, no servers
required.
Task finishing - If your app is in
mid-task when your customer leaves it,
the app can now keep running to finish
the task.
Fast app switching - All developers
should take advantage of fast app
switching, which allows users to leave
your app and come right back to where
they were when they left - no more
having to reload the app.
Nope. The only way for your application to be "called" when it's not already open is by sending a push notification.

iphone is it possible to register my application so the os notifies it every X seconds?

Hello I would like to know if there is an equivalent to the android's alarmManager so I can register my app to be waken every X seconds?
No. At least not directly Here's the list of all kinds of multitasking that Apple supports from its's What's new page:
Multitasking
iOS 4 delivers seven new multitasking
services that allow your apps to
perform tasks in the background while
preserving battery life and
performance. These multitasking
services include:
Background audio - Allows your app to play audio continuously. So
customers can listen to your app while
they surf the web, play games, and
more.
Voice over IP - Your VoIP apps can now be even better. Users can now
receive VoIP calls and have
conversations while using another app.
Your users can even receive calls when
their phones are locked in their
pocket.
Background location - Navigation apps can now continue to guide users
who are listening to their iPods, or
using other apps. iOS 4 also provides
a new and battery-efficient way to
monitor location when users move
between cell towers. This is a great
way for your social networking apps to
keep track of users and their friends'
locations.
Push notifications - Receive alerts from your remote servers even when
your app isn't running.
Local notifications - Your app can now alert users of scheduled events
and alarms in the background, no
servers required.
Task finishing - If your app is in mid-task when your customer leaves it,
the app can now keep running to finish
the task.
Fast app switching - All developers should take advantage of fast app
switching, which allows users to leave
your app and come right back to where
they were when they left - no more
having to reload the app.
Adding to Georg's answer, you probably want this:
Local notifications - Your app can now alert users of scheduled events and alarms in the background, no servers required.
Unfortunately it also requires the user to okay relaunching the app to run your code.