• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

pass broadcast from the Service class to the Map activity.

Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have TrackingService component to track the location of the buses in my city based on Crowdsourcing. In the TrackingService class I have variable `pLong, pLat` to stored the latitude and longitude when they are calaculated in the `onLocatiochChanged()`. The TrackingService is operating in the background, then the data is transmitted to the server. I have an Map Activity to display the location of the buses, the user selected in the MainActivity( as Filter).

The background TrackingService is started in the MainActivity when the app launches.

I am trying to pass the `pLat, pLong` from the `onLocationChanged()` to the `Map` activity when the `onLocationChanged()`is being invoked to display the user's current location beside the bus's locations with the aid of BroadcastReceiver.

I have debugged my code and facing problem that I am getting `0.0` for the values `lat, lng` in the BroadcastReiceiver in the `map` activity also the `bReceiver` is being invoked.

How can I get it to work to retrieve the lat and lng vlaues in the BroadcastReceiver `bReceiver`?

I appreciate any help.

TrackingService class

Map activity


    Bookmark Topic Watch Topic
  • New Topic