Helo. i write the belowing code. This code runs correctly in my application. i want to ask this. "speed" and "course" variables on this code returns "NAN". Where do i make wrong?
The second question is that : the location updates become once in a minute, but i want to update once in 5-10 second. Is it possible ? Thanks.
Code:public void Connection () throws LocationException { if(istracking==false) { istracking=true; screen.setCurrent(finf); finf.append("Connecting......"); cr=new Criteria(); cr.setHorizontalAccuracy(25); provider=LocationProvider.getInstance(cr); if(provider!=null) provider.setLocationListener(this,-1,-1,-1); } } public void locationUpdated(LocationProvider provider, Location location) { upDate t=new upDate(); t.start(); } public void providerStateChanged(LocationProvider provider, int newState) { } public class upDate extends Thread { public void run() { try { loc=provider.getLocation(60); if(loc.isValid()) { String s=""; finf.deleteAll(); coor=loc.getQualifiedCoordinates(); double lt=coor.getLatitude(); double lon=coor.getLongitude(); float course=loc.getCourse(); double speed=loc.getSpeed(); long time=loc.getTimestamp(); s="Langitude: "+lt+"\\nLongitute: "+lon+ "Course: "+course+"\Speed : "+speed+"\nTime: "+time; finf.append(s); } } catch(Exception ex) { } }

Reply With Quote


