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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:44:58+00:00 2026-06-15T04:44:58+00:00

The application is being developed in 2.3.3 In my application, I am starting a

  • 0

The application is being developed in 2.3.3

In my application, I am starting a service from a broadcast receiver. The service calls the Location Manager and gets latitude and longitude. Is it possible to send the latitude and longitude values back to broadcast receiver from Service?

If Yes? How do we do it?

If No? -> which is my approach as of now… I have used a SharedPreferences object to hold these values and access them in BroadCast Receiver. Will this work?

I do have few more questions on this, will edit my question after the answers…
Thanks..

[Edit] Answer to my above question -> So we can send data from Service to Broadcast Receiver, though it’s not a good practice in general.

  • 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-15T04:44:59+00:00Added an answer on June 15, 2026 at 4:44 am

    It is possible to pass the information back to the broadcast receiver by broadcasting a new intent from the service that has the location data. You will need to create a custom action for the intent and have your broadcast receiver register to handle that action. Creating and receiving intents with custom actions is described here.

    However, I think in pretty much every case this is a bad approach. In general broadcast receivers should merely parse intents and launch intent services to do all of the work. If something needs to be done with the location then the service should do it not the broadcast receiver. It is also important to note that at the end of onReceive() the broadcast receiver is immediately destroyed so you lose all of its state.

    I’d be happy to answer more questions or update my answer to be more specific if you provided more information as to the purpose of lat/long gathering task.

    [EDIT] Since I can’t comment I’ll add my two cents to Kerim’s answer. Unless I am missing something huge (if I am please let me know Kerim since you can comment on mine) may not work the way you expect. When the broadcast receiver’s onReceive() function finishes the broadcast receiver will be destroyed. The handler you sent will live on but any data in the broadcast receiver will not exist and the handler will not be able to call the broadcast receiver’s functions. Since the handler can’t access any of the broadcast receiver’s data or functions, you might as well do everything that needs to be done in the service.

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

Sidebar

Related Questions

I am working on a business application which is being developed from scratch. We
My application is being developed in silverlight. Plan to launch it later this year.
I'm trying to practise deploying a django application that is being developed. i've updated
I a web application that I am developing (being developed in PHP) when a
I want to prevent my application from being reverse engineered and decompiled by someone
How do I prevent my device administration application from being installed? I have created
I have a flex application being developed in Spanish, and I'd like to build
I have a web application project being developed in VS2010 targetting Framework 4.0. I
I am getting an error in my GWT application being developed in Eclipse. It's
The desktop application I'm working on is being developed in Adobe AIR + Flex

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.