Android makes it really easy to get the current location and time.
Getting the time (presumably if you are trying to get this to
production you would like to get the current time of the system) so
you would do something like (Google recommends using the
GregorianCalendar object in Java):
GregorianCalendar time=new GregorianCalendar(); //new instance is set
to the current time
location is a bit trickier but still rather simple. Getting a location
in Android is done through the locationManager
locationManager =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = locationManager.getCurrentLocation("gps");
Now in theory Android phones will have more than one location provider
and you will be able to select from them.
I believe currently the emulator only supports gps.
Also remember that to access the location you will need to set your
permissions in the AndroidManifest file. Make sure to do that or else
you will get an error.
Hope that helps!
Fernan.do
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---