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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:17:40+00:00 2026-05-28T02:17:40+00:00

This is more of a theoretical question than code: What i did till now

  • 0

This is more of a theoretical question than code:
What i did till now :

My app is heavily dependent upon location tracking.

I posted a question about it around 5 hours back without a suitable answer and it is now pretty old to put a new question there .i will closing it after i get an answer for this question.

What i want to do is to have a button that user presses.it makes location manager to start updating locations and then for every 5 feet moved . i want to make iPhone play random sounds.
i implemented correct code given below and now i tested on my device moving from one place to here in my house. through trial and errors i got to know that first few locations are iPhone trying to get an accurate results and are generally to be avoided so i made it a condition to process location which come after more than 2 seconds to previous.

Now my Real ques :
I have my device on wifi.(don’t have gps and can’t have) so after few initial useless location updates . my alerts stop showing.. i was like : why isn’t working . i set it to accuracy best. did filtering to 1.5 meters .. i was moving like 15 feets in the house and no update ?..now i think it is because it is taking locations through wifi and hence it is founding no new locations even if i move 40 feeds around that wifi.? am i correct?

If that is true .. can anyone tell will this work correctly in gps .. for U.S. users..where they have lots of towers.. so that my app will correctly update that new location is at least 5 meters away from its previous location..

Sorry for the long question.. There are too many doubts for me..

-(id) init
{
    if(self = [super init])
       {
           locationManager = [[CLLocationManager alloc] init];
           locationManager.delegate = self;
//           locationManager.distanceFilter = 1.5;
           locationManager.desiredAccuracy = kCLLocationAccuracyBest;
           return self;   
       }
    return nil;
}



- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {


    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"New Lcoation"
                                                    message:nil
                                                   delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
    [alert show];
    [alert release];


    self.currentLocation = newLocation;

    BOOL newLocationIsValid = [self isValidLocation:newLocation withOldLocation:oldLocation];
    if(newLocationIsValid && oldLocation)
    {
        int distance = [newLocation distanceFromLocation:oldLocation];
        if(distance >2 && distance <10)
        {

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Distance"
                                                        message:[NSString stringWithFormat:@"%i meters",distance]
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
        [alert release];
            [fileURl release];
        }
    }
}

-(BOOL)isValidLocation:(CLLocation*)newLocation withOldLocation:(CLLocation*)oldLocation
{  

    if(newLocation.horizontalAccuracy < 0 )
    {
        return NO;
    }
    NSTimeInterval secondsSinceLastPoint = [newLocation.timestamp timeIntervalSinceDate:oldLocation.timestamp];
    if(secondsSinceLastPoint < 0)
    {
        return NO;
    }

    if(secondsSinceLastPoint < 2)
    {
        int distance = [newLocation distanceFromLocation:oldLocation];

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Distance"
                                                        message:[NSString stringWithFormat:@"%i meters",distance]
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
        [alert release];
        return NO;
    }

    return YES;
}
  • 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-28T02:17:41+00:00Added an answer on May 28, 2026 at 2:17 am

    yes, doesn’t work because you use wifi for locating. The Location-Service just know where your wifi is, not your position relative to your wifi (that would be nice).

    so for your service you must use gps. and even then, the accuracy is not garanteed.

    see http://www.kowoma.de/en/gps/accuracy.htm

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

Sidebar

Related Questions

This is more of a theoretical question than an actual problem I have. If
This is more a theoretical question than a practical one, but given I undestand
This is more of a theoretical question rather than language specific, but I'm mostly
This is more of a theoretical question than a specific one. I have a
This is a theoretical question more than anything else. In the case of C#
This is more of an academic inquiry than a practical question. Are there any
This is more an observation than a real question: MS-Access (and VBA in general)
this is more a theoretical question i asked myself. I remembered that BinarySearch of
This is a more theoretical question about macros (I think). I know macros take
This is more of a theoretical question. Should logging reside within a class who's

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.