Android map tracking and icon movement

I am working on an application that will provide a route for a student shuttle. I have successfully built this application that will show a route map along with stops. Now I would like to add new functionality that will show the location of the shuttle shuttle in real time. When the student looks at the shuttle minibus, they should also see the move icon on the map, which is the shuttle's location in real time. Any idea how this can be done ... ???

Thanks in advance

+3
source share
1 answer

, GPS , stackoverflow.com : Android?

google api, : using-google-maps-android

Update:

public class JsonDownloader{

    private static final String URI = "http://mySite.net/rest/getData.php";

    @SuppressWarnings("unchecked")
    public static String receiveData(){
        String result = "";
        DefaultHttpClient client = new DefaultHttpClient();
        HttpGet method = new HttpGet(url);
        HttpResponse res = null;
        try {
            res = client.execute(method);
        } catch (ClientProtocolException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

        try{
             InputStream is = res.getEntity().getContent();
             BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"));
             StringBuilder sb = new StringBuilder();
             String line = null;
             while ((line = reader.readLine()) != null) {
                     sb.append(line + "\n");
             }
             is.close();
             result = sb.toString();
        }catch(Exception e){
             Log.e("log_tag", "Error converting result "+e.toString());
        }
        return result;
    }
} 

HTTP- , php script. gps- - .

gps , , . . postData: http://www.androidsnippets.org/snippets/36/index.html

, , . : http://android-projects.de/2010/08/13/threading-in-android-apps/

+1

Source: https://habr.com/ru/post/1779318/


All Articles