Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7935609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:58:34+00:00 2026-06-03T21:58:34+00:00

I am trying to use XMPPFramework to show background notifications in the 10 minute

  • 0

I am trying to use XMPPFramework to show background notifications in the “10 minute window” before the application is terminated. It appears that all of the network requests are being queued while it is in the background, and xmppStream:didReceiveMessage: isn’t being called until the app is brought back to the foreground.

I have noticed apps like Verbs support this behavior. They are clearly not a VoIP app, so I am curious as to how they accomplished this behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:58:36+00:00Added an answer on June 3, 2026 at 9:58 pm

    In case anyone else has this issue, you can solve it by adding this code to your App Delegate. My full source code is here if you want to check it out: OTRAppDelegate.m. The other relevant code is in receiveMessage: of OTRBuddy.m.

    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
        NSLog(@"Application entered background state.");
        NSAssert(self.backgroundTask == UIBackgroundTaskInvalid, nil);
        self.didShowDisconnectionWarning = NO;
    
        self.backgroundTask = [application beginBackgroundTaskWithExpirationHandler: ^{
            dispatch_async(dispatch_get_main_queue(), ^{
                NSLog(@"Background task expired");
                if (self.backgroundTimer) 
                {
                    [self.backgroundTimer invalidate];
                    self.backgroundTimer = nil;
                }
                [application endBackgroundTask:self.backgroundTask];
                self.backgroundTask = UIBackgroundTaskInvalid;
            });
        }];
    
        dispatch_async(dispatch_get_main_queue(), ^{
            self.backgroundTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerUpdate:) userInfo:nil repeats:YES];
        });
    }
    
    - (void) timerUpdate:(NSTimer*)timer {
        UIApplication *application = [UIApplication sharedApplication];
    
        NSLog(@"Timer update, background time left: %f", application.backgroundTimeRemaining);
    
        if ([application backgroundTimeRemaining] < 60 && !self.didShowDisconnectionWarning) 
        {
            UILocalNotification *localNotif = [[UILocalNotification alloc] init];
            if (localNotif) {
                localNotif.alertBody = EXPIRATION_STRING;
                localNotif.alertAction = OK_STRING;
                [application presentLocalNotificationNow:localNotif];
            }
            self.didShowDisconnectionWarning = YES;
        }
        if ([application backgroundTimeRemaining] < 10) 
        {
            // Clean up here
            [self.backgroundTimer invalidate];
            self.backgroundTimer = nil;
            [application endBackgroundTask:self.backgroundTask];
            self.backgroundTask = UIBackgroundTaskInvalid;
        }
    }
    
    - (void)applicationWillEnterForeground:(UIApplication *)application
    {
    
    }
    
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        /*
         Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
         */
        NSLog(@"Application became active");
        if (self.backgroundTimer) 
        {
            [self.backgroundTimer invalidate];
            self.backgroundTimer = nil;
        }
        if (self.backgroundTask != UIBackgroundTaskInvalid) 
        {
            [application endBackgroundTask:self.backgroundTask];
            self.backgroundTask = UIBackgroundTaskInvalid;
        }
    
        application.applicationIconBadgeNumber = 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying use the mysql connector in c++ in ubuntu. It appears that
I am trying to use XMPPFramework with an iOS5 project (ARC) under xcode 4.2.1
I am trying use an if statement and TWO .addClass background-color variables based on
Trying to use code from here Im trying to incorporate both classes so that
I have been trying use the edit_post_link() function to contain an image. All of
I'm trying use make a div's background transparent using a mixture of CSS3 rgba()
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a
Trying to use the getDependentRowset in a ZF application. I have the following relationship

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.