app with GPS-enable but the device is indoor

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Postby zehunter » Tue Mar 30, 2010 9:11 pm

Ressor wrote:Opps! I freaked out too soon and figure it out on my own.


hi,

can i ask you to post an example of how you use this code? :-)
can help many people, starting me :-)
zehunter
Developer
Developer
 
Posts: 27
Joined: Sun Jan 10, 2010 10:45 am

Top

Postby Ressor » Tue Mar 30, 2010 9:39 pm

This is the Location Manager class:
I cut and paste the code for the class into my project and give it a relevant name like MyLocationManager.java


And then this is how I use it in my other Activity:

I declare a variable to hold the reference to the object above the onCreate in my Activity:

private MyLocationManager mlm;

I instanciate it like this from within the onCreate:

mlm = new MyLocationManager(getBaseContext());
mlm.startLocationReceiving();

Location location = mlm.getCurrentLocation();
String lat = Double.toString(location.getLatitude());
String lng = Double.toString(location.getLongitude());


That is about it...

Then I call the other methods from it to stop and start as needed.
Ressor
Developer
Developer
 
Posts: 28
Joined: Wed Oct 14, 2009 11:43 pm
Location: Boston MA USA

Postby zehunter » Wed Mar 31, 2010 6:35 am

Ressor wrote:This is the Location Manager class:
I cut and paste the code for the class into my project and give it a relevant name like MyLocationManager.java


And then this is how I use it in my other Activity:

I declare a variable to hold the reference to the object above the onCreate in my Activity:

private MyLocationManager mlm;

I instanciate it like this from within the onCreate:

mlm = new MyLocationManager(getBaseContext());
mlm.startLocationReceiving();

Location location = mlm.getCurrentLocation();
String lat = Double.toString(location.getLatitude());
String lng = Double.toString(location.getLongitude());


That is about it...

Then I call the other methods from it to stop and start as needed.


fantastic! :) thanks for your help !
i will try this this evening!
zehunter
Developer
Developer
 
Posts: 27
Joined: Sun Jan 10, 2010 10:45 am

Top
Previous

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 7 guests