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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:25:33+00:00 2026-06-04T07:25:33+00:00

Needs I want to turn the screen off when the user places his iphone

  • 0

Needs

I want to turn the screen off when the user places his iphone upside down on q desk. At the same time I do not want to have the proximity monitor enabled all the time as this is very uncomfortable for the user and miss fires a lot of times depending on how you grab the device.

What for

This is to leave at night and save battery and screen life while still running the app.

The workaround

I am thinking of is to use the accelerometer to determin if the face is down, if so activate the proximity censor. Simple stuff…

The problem

In practice the workaround does not work, It seams that if the censor is “occluded” when you activate it, it will not register its current state.

Refresh UIDevice some how?

What I’m Using

-(id)init {
    if ((self = [super init])) 
    {
        NSLog(@"Init ShakerAnalizer");
        accelerometer = [UIAccelerometer sharedAccelerometer];
        accelerometer.delegate = self;
        accelerometer.updateInterval = 5.0f;
    }
    return self;
}

-(void)accelerometer:(UIAccelerometer *)accel didAccelerate:(UIAcceleration *)acceleration
{
    if (accelerometer) 
    {        
        NSLog(@"Accelerometer Z:::  %f", acceleration.z);

        if (acceleration.z > kFlippedThreshold) 
            device.proximityMonitoringEnabled = YES;
        else
            device.proximityMonitoringEnabled = NO;
    }
}
  • 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-04T07:25:35+00:00Added an answer on June 4, 2026 at 7:25 am

    Using the accelerometer to determin if phone is facing down to activate the proximity censor works well. Using a fast refresh rate to determin when the phone flips is crusial as if you activate the proximity censor when already occluded the screen will stay on. Once the phone is fasing down you can lower the refresh rate to save battery.

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

Sidebar

Related Questions

I want to send device to sleep or turn the screen off. I have
I want to develop a little iPhone application, just for my personal needs. I
I have an Activity that usually needs some time to watch the screen without
I am trying to figure out how to turn off the screen from within
I want to write an app to turn auto-rotation on and off automatically depending
I want to change the advanced search layout to my needs. Instead of select
I want edit multiple strings at once by selection the list of strings needs
I have a program that needs a lot of memory and want to set
i have a UITableView where i want one cell(database row) needs to be default,
I have a NSIS installer I want to be totally silent unless it needs

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.