So I am using Android points = new ArrayList<LatLng>();
to track a users GPS location every 3 seconds, which sometimes can be up to 1,000's or more points if they are on a route long enough. What is the best method for sending this route after they finish to my php and storing it into mysql? I am currently using volley to connect to my database, but it seems to time out if I try to send too much information in a loop, IE each location individually.
Here is how I get my LatLng:
mLastLocation = location;
LatLng latLng = new LatLng(latitude, longitude);
points.add(latlng);
Here is my volley request:
RequestQueue queue = Volley.newRequestQueue(context);
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL_FOR_GPS,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("GPS save route", response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
}){
//adding parameters to the request
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("command", "saveGPSroute");
params.put("userId", userId);
return params;
}
};
// Add the request to the RequestQueue.
queue.add(stringRequest);