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 6702123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:00:58+00:00 2026-05-26T07:00:58+00:00

Hi In my project I need to call accelerometer while call is activated I

  • 0

Hi In my project I need to call accelerometer while call is activated I use this code for calling accelerometer during call.

- (void)applicationDidEnterBackground:(UIApplication *)application
{
 if(isSlamOff == FALSE){
        NSLog(@"Slame is off");

       if(callState == CTCallStateConnected) {
        UIAccelerometer *accelerometer =[UIAccelerometer sharedAccelerometer]; 
        accelerometer.updateInterval = 0.1; 
        accelerometer.delegate = self;
       }
}

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{

   UIAccelerationValue x, y, z;
    x = acceleration.x;
    y = acceleration.y;
    z = acceleration.z;
    NSLog(@"x is %4.2f, y is %4.2f and z is %4.2f",x,y,z);

    magnitude = sqrt(acceleration.x * acceleration.x
                     + acceleration.y * acceleration.y
                     + acceleration.z * acceleration.z);
   NSLog(@"%f",magnitude);

   if(magnitude > 2.5){
    NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"slamshort" ofType:@"wav"];
    NSURL *newURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
    AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:newURL error: nil];
    [newPlayer prepareToPlay];
    NSLog(@"Music Is Playing");

    AudioSessionSetProperty(kAudioSessionOverrideAudioRoute_Speaker, sizeof(newPlayer),&newPlayer);
    [newPlayer setVolume: 1.0];
    [newPlayer play];
   }
}

But it neither show the call status nor run the acceleration in background during call, and I used this from the latest multitasking function guide from apple iOS but not show the status of call and accelerometer is not running in the background. Is it possible to sense acceleration during call and play a audio file during call or it is not possible in iOS. Or if it is possible then what is the way or code to make it possible.

  • 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-05-26T07:01:00+00:00Added an answer on May 26, 2026 at 7:01 am

    iOS is not real multitasking operating system, so currently you cannot run accelerometer code while app is at background.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my project I need to use third party code, stored in several Git
I use inline assembly massively in a project where I need to call functions
Ours is a huge project. I need to call certain functions in my code
For a project we need to add attachments to workitems through a Silverlight application.
I need to call exec and build a wix setup project. Currently I have
If I need to call a specific function in the parent application from a
I'm working on a hobby project where I need to call a managed delegate
In my current project, i need to call a Unix shell script from the
I need to call a wcf service method in my project, if I have
I'm using this library for Facebook graph API access within my codeigniter project: http://www.haughin.com/code/facebook/

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.