I am creating a service that will provide updates to users in every 5 minutes. I am using DDS to send coordinates to the emulator. I want to change coordinates and find the place. how can I do this? I'm new to Android Please help. This is my code so far
increases the public class GetLocationService service {secure location manager location manager; Start button; @Ivarried Public Ibir On Bund (Intent Arg 0) {// Two-Auto Object Method Stub Return Null; } @ Override Public Start Start Commands (Intent Intent, Int Flag, IntstartID) {Place Manager LocationNiger = (Location Manager) System System (LOCATION_SERVICE); LocationListener ll = new MyLocListener (); Location location = new location ("ABC"); Ll.onLocationChanged (location); LocationManager.requestLocationUpdates (LocationManager.GPS_PROVIDER, 1000, 0, ll); Return START_STICKY; } Implementation of Private Class MyLocListener LocationListener {Transfered to Public Zero (Location Location) {if (location! = Null) {Log D. ("Location changed", location .getLatitude () + ""); Log D. ("Location changed", location.gate lengthy () + ""); } Toast. Make Text (GetLocationService.this, location.getLatitude () + "" + location.getLongitude (), toast .LENGTH_LONG) .show (); }}}}
Try it out:
Try {GeoCoder Bhoo = New GeoCoder (yourctivityclassname.at.app applicationcontacts (), local.get default ()); & Lt; Address & gt; Addresses = geo.getFromLocation (latitude, longitude, 1); If (addresses.isEmpty ()) {yourtextfieldname.setText ("Waiting for location"); } And {if (addresses.size ()> gt; {log} (Tag, address.gate (0) .getFeatureName () + "," + addresses.get (0) .getLocality () + "," + Addresses.get (0) .getAdminArea () + "," + addresses. Get (0) .getCountryName ()); }}} Hold (exception e) {e.printStackTrace (); }
Comments
Post a Comment