update server with android location
<p>OnLocationChanged gives me 11 points and every time I have 11 calls to php page.How to make 
sure that I send each time only the last 11-th (it may not be 11) location point .It may be a good way to first insert data into sqlite database and later on call a timer to take the last row of sqlite table and to pass it to php page , later it would delete the table and repeat all in 2 minutes .</p>

<pre><code>public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final EditText ed1=(EditText) findViewById(R.id.editText1);
    final EditText ed2=(EditText) findViewById(R.id.editText2);
    final EditText ed3=(EditText) findViewById(R.id.editText3);


    final WebView w=(WebView) findViewById(R.id.webView1);
    final Time t=new Time();

    //deo koji naknadno ubacujem za kriterijum
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setPowerRequirement(Criteria.POWER_LOW);



    //kraj dela koji sam naknadno ubacio

final   LocationManager m=(LocationManager) MainActivity.this.getSystemService(Context.LOCATION_SERVICE);
    //deo koji sam takodje ubacio naknadno
String locationprovider =m.getBestProvider(criteria,true);
//deo koji sam takodje ubacio naknadno kraj


        LocationListener l=new LocationListener() {

                @Override
                public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onProviderEnabled(String arg0) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onProviderDisabled(String arg0) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onLocationChanged(Location arg0) {
                    /*
                    java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
                    String date = dateFormat.format(new Date());
                */
                    //novi datum 
                    /*
                    Date datum = new Date(); 
                    SimpleDateFormat sdf; 
                    sdf = new SimpleDateFormat("MM/dd/yyyy");
                    String  date=sdf.format(datum);
                    //novi datum
                    */
                    /*
                    //treci datum
                    String pattern = "MM/dd/yyyy";
                     SimpleDateFormat format = new SimpleDateFormat(pattern);
                    String date= format.format(new Date());
                    //treci datum

                     */
                    //cetvrti datum
                    String format="MM/dd/yyyy";
                    SimpleDateFormat sdf = new SimpleDateFormat(format,Locale.US);
                    String date= sdf.format(new Date());
                    //cetvrti datum
                    String url=new String();
                t.setToNow();   

                ed1.setText("");
                ed2.setText("");
                String longitude=new String();
                String latitude=new String();
                String speed=new String();

                if((int)arg0.getSpeed()==0)
                {
                    speed="0";
                }
                else
                {
                speed=""+(((int)arg0.getSpeed()*3600)/1000);
                }
                longitude=""+  arg0.getLongitude();
                latitude=""+ arg0.getLatitude();
                ed1.setText(longitude);
                ed2.setText(latitude);
                ed3.setText(speed);
                Calendar cal=Calendar.getInstance();


                url="http://www.compensatemeonline.com/truckmeonline/TruckMeOnline/UnosLokacijaSaTelefona.php?id=16"+"&amp;longitude="+longitude+"&amp;latitude="+latitude+"&amp;brzina="+speed+"&amp;vreme="+cal.getTime()+"&amp;datum="+date; 
                try{
                w.loadUrl(url);
                }
                catch (Exception e) {
                    // TODO: handle exception
                }
                    // TODO Auto-generated method stub

                }

            };


            // TODO Auto-generated method stub
            m.requestLocationUpdates(locationprovider, 120000, 0, l);

    //      zamenio sam m.requestLocationUpdates(LocationManager.GPS_PROVIDER, 120000, 0, l); sa m.requestLocationUpdates(locationprovider, 120000, 0, l);
        }




@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
</code></pre>

<p>}</p>
