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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:13:17+00:00 2026-05-22T15:13:17+00:00

In my app I’m using a GPS listener. I need to turn off the

  • 0

In my app I’m using a GPS listener. I need to turn off the GPS and activate it later. Currently I’m using

locationManager.removeUpdates(locationListener);

to turn off the gps. That will turn the GPS off. But later I’m not able to turn it on? Is there any other methods to turn off the gps?

For activating the GPS I’m using

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, updatesInterval, 0, locationListener);
  • 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-22T15:13:18+00:00Added an answer on May 22, 2026 at 3:13 pm

    I want the gps to return the most accurate value. So I set the minValue and minDistance value of the requestLocationUpdates function to 0.

    Then to solve the problem with battery drain I’ll start and stop the gps (which is a service) when the app comes to foreground and when the app enters background.

    To start the GPS i used

    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
    

    in the onCreate of the service.

    To end the GPS i used

    locationManager.removeUpdates(locationListener);
    

    in the onDestroy of the service.

    You have to do the starting and stopping of the gps in a service, so that you can start and stop the same instances of the location listener otherwise this thing will go drastically wrong

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

Sidebar

Related Questions

The app Im working on uses gps and sometimes in the onResume when the
My app is crashing using iOS5 and iOS4.3 iPhone simulators in Xcode 4.2, the
My app is slowed down by N+1 queries. I'm using the will_paginate gem with
We're building an app, our first using Rails 3, and we're having to build
app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] })); That's the line in my app.js
My app makes several calls to getFromLocationName from the android.location.Geocoder; class, this is currently
App store approval guideline says that Apps that send Push Notifications without first obtaining
app.get(/:name?/:group?, function(req, res){... is matching files that are in my public directory. So if
Our app (already deployed) is using an Access/Jet database. The upcoming version of our
I am using Paperclip to handle profile photo uploads in my app. They upload

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.