Hi ALL,

I’m developing a Fleet Management application in PHP which tracks
location of all cars and shows up in a web browser.

I have also developed a little app for the android which will send the
location / time to the server when I press the button ???

I need to be able to do the following

Have a start up page with the following:

Website URL field: e.g http://www.****.co.uk/logtracking.php
Frequency field:e.g  6 (Seconds)
Start/Stop button.

When you click the Start button it will send the location, time and
any other fields to the web address inputted. I will collect these
using php with my tracking application

The app will be able to be closed and run in the background until you
click the stop button.

If the internet is down it would take a log and send them one up
again.. ????

This is a really simple app. Just for my use whilst I test my tracking
Application.

Can anybody guide me on the best way to do this ? Or better still give
me a price on writing it for me.

My knowledge on Android is very limited.

Heres what I have done so far:

It simply send the location stuff when i click a button.



package sendLocation.android.com;
        import java.net.URLEncoder;
import java.text.DateFormat;

import sendLocation.android.com.GetStuffFromWeb;

import android.app.Activity;
        import android.content.Context;
        import android.location.Location;
        import android.location.LocationListener;
        import android.location.LocationManager;
        import android.os.Bundle;
        import android.util.Log;
        import android.view.Menu;
        import android.view.MenuItem;
        import android.widget.TextView;
import android.widget.Toast;

        public class SendLocation extends Activity {
                LocationManager lm = null;
                Location loc = null;
                public static final String TAG = "LOQUERIO";
                private LocationListener locationListener;
                @Override
                public void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.main);
                        lm = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);
                        locationListener = new MyLocationListener();
                        lm.requestLocationUpdates
(LocationManager.GPS_PROVIDER, 0, 0,
                                        locationListener);
                }
                private void initActivity() {



                            loc = lm.getLastKnownLocation("gps");
                        if (loc == null) {
                                Log.e("mylocation", "failed to determine my
location");
                        } else {



                                Log.i("mylocation", loc.toString());



                                //TextView text = (TextView) findViewById
(R.id.lblTest);
                                //text.setText(loc.toString());


                                GetStuffFromWeb textResult = new
GetStuffFromWeb(); //initiate the Class
                                     textResult.setURL("http://www.theURL.com/
live.php?id="+loc.toString()); //set the URL
                                     String theResults = textResult.retrieve();
                                     TextView text3 = (TextView) findViewById
(R.id.lblTest3);
                                     text3.setText(theResults);

                        }





                }



                @Override
                public boolean onCreateOptionsMenu(Menu menu) {
                        super.onCreateOptionsMenu(menu);
                        menu.add(0, 27, 0, "GetLocation").setIcon(
                                        android.R.drawable.ic_menu_add);
                        return true;
                }
                @Override
                public boolean onMenuItemSelected(int featureId, MenuItem
item) {
                        switch (item.getItemId()) {
                        case 27:
                                initActivity();
                                return true;
                        }
                        return super.onMenuItemSelected(featureId, item);
                }
                private class MyLocationListener implements LocationListener
{
                        public void onLocationChanged(Location loc) {
                                // Called when the location has changed.
                                Log.d(TAG, "===>>> MinhaLocalizacaoListener
onLocationChanged");
                                if (loc != null) {
                                        Toast.makeText(
                                                        getBaseContext(),
                                                        "Location changed :
Lat: " + loc.getLatitude()
                                                                        + "
Lng: " + loc.getLongitude(),
        
Toast.LENGTH_SHORT).show();


//HERE HERE HERE HERE HERE HERE HERE
// Maybe I can call the server from here but don't do it if its not
been past the amount of seconds.


                                }
                        }
                        public void onProviderDisabled(String provider) {
                                // Called when the provider is disabled by
the user.
                                Log.d(TAG, "===>>> MyLocationListener
onProviderDisabled PROVIDER:"
                                                + provider);
                                // Mapa.ehPraAtualizar = false;
                        }
                        public void onProviderEnabled(String provider) {
                                Log.d(TAG, "===>>> MyLocationListener
onProviderEnabled PROVIDER:"
                                                + provider);
                                // Called when the provider is enabled by the
user.
                        }
                        public void onStatusChanged(String provider, int
status, Bundle
        extras) {
                                Log.d(TAG, "===>>> MyLocationListener
onStatusChanged STATUS:"
                                                + status + " PROVIDER:" +
provider);
                                // Called when the provider status changes.
                        }
                }
        }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to