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

  • Home
  • SEARCH
  • 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 8776503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:04:40+00:00 2026-06-13T19:04:40+00:00

I want to build a function where the current location of the user will

  • 0

I want to build a function where the current location of the user will be send to the server in every 5 minutes.Doesn’t really sound like something Apple is going to like.
This will be an in-house app though (and the users know their location are used), are rules less strict for this? Anyone any experience on this?

Thanks in advance!

  • 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-13T19:04:41+00:00Added an answer on June 13, 2026 at 7:04 pm

    Seems like a very straight forward case.

    Enabled background location service requirement in your PLIST file, put a disclaimer in your app description stating continuous use of GPS in background will drastically drain battery, then have your code upload your GPS location every 5 minute.

    It’ll work even in background 🙂

    I have an app on the app store that records the user’s route live as the user drives around, though it doesn’t send to the server, it does track the user’s own location constantly and when the user is done, they can stop the GPS tracking.

    Some Code Suggestions

    Tracking user’s location isn’t a one line thing but I can suggest a learning route, which isn’t too overwhelming.

    First of all, there are two parts to your problem:

    a) Tracking user’s location
    b) Sending the user’s GPS coordinate to the server

    Tracking User’s Location

    Tracking the user’s location can be done in two ways. You can either use CLLocationManager to track the user’s location or if you want the quick and dirty method, you can use the MKMapView’s delegate method:

    // --------------------------------------------------------------
    // Example .m files implementation
    // --------------------------------------------------------------
    -(void)viewDidLoad
    {
        ...
        myMapView.delegate = self;
        ...
    }
    
    // --------------------------------------------------------------
    // this MapView delegate method gets called every time your 
    // user location is updated, you can send your GPS location
    // to your sever here
    // --------------------------------------------------------------
    - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
    {
        // pseudo-code
        double latitude = userLocation.coordinate.latitude;
        double longitude = userLocation.coordinate.longitude;
    
        // you need to implement this method yourself
        [self sendGPSToServerWithLatitude:latitude AndLongitude:longitude];
    }
    
    // sends the GPS coordinate to your server
    -(void)sendGPSToServerWithLatitude:(double)paramLatitude AndLongitude:(double)paramLongitude
    {
        // ------------------------------------------------------
        // There are other libraries you can use like
        // AFNetworking, but when I last tested AFNetworking
        // a few weeks ago, I had issues with it sending
        // email addresses or multiple word POST values
        // ------------------------------------------------------
    
    
        // here I am using ASIHttpRequest library and it's ASIFormDataRequest.h class
        // to make a POST value to a server. You need to build the server web service
        // part to receive the latitude and longitude
        NSURL *url = [NSURL urlWithString:@"http://www.youserver.com/api"];
    
        __block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
        [request setPostValue:[NSNumber numberWithDouble:paramLatitude] forKey:@"latitude"];
        [request setPostValue:[NSNumber numberWithDouble:paramLongitude] forKey:@"longitude"];
        [request setPostValue:userNameString forKey:@"username"];
    
        [request setCompletionBlock:^{
            NSDictionary *data = [request responseString];
    
            NSLog(@"Server response = %@", data);
        }];
    
        [request setFailedBlock:^{
            NSLog(@"Server error: %@", [[request error] localizedDescription]);
        }];
    
        [request startAsynchronous];
    }
    

    PHP Server-side Code

    // --------------------------------------------------------------
    // This is an example server implementation using PHP and Symfony
    // web framework.
    //
    // You don't have to use PHP and Symfony, you can use .NET C# too
    // or any other server languages you like to build the web service
    // --------------------------------------------------------------
    
    class DefaultController
    {
        ...
    
        // -------------------------------------
        // expects and latitude and longitude
        // coordinate pair from the client
        // either using POST or GET
        // -------------------------------------
        public function recordGPSLocationAction()
        {
            // checks to see if the user accessing the
            // web service is authorized to do so
            if($this->authorize())
            {
                return new Response('Not authorized');
            }
            else // assume user is authorized from this point on
            {
                // check to see if user has passed in latitude and longitude
                if(!isset($_REQUEST['latitude']) || !isset($_REQUEST['longitude']
                || !isset($_REQUEST['username'])
                {
                    throw $this->createNotFoundException('Username, Latitude or Longitude was not received');
                }
                else
                {
                    // write your latitude and longitude for the specified username to database here
    
                    ....
    
                    return new Response('User GPS location saved');
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to know what wordpress build-in function you will use when sanitizing specific
I want to build a bookmarklet that will allow me to send the URL
I want to build a program that prints the current screen (every few seconds)
i want to build a screen for user to get his marks on competitions,
I want to build flash application that can detect the user eyes color and
I want to build a form_tag that will allow me to post a new
I want to build a basic Client-Server application, where my android smartphone can stream
My known data are my current location (GeoPoint) and radius in meters. I want
I want to build a few conditions to kick a user out of an
I want to highlight the current navigation state. Like if the hashchange is #home

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.