Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #2421 - Adding minimal events size check to avoid sending e…
Browse files Browse the repository at this point in the history
…mpty json data to server
  • Loading branch information
bleege committed Feb 11, 2016
1 parent 0d639c7 commit 5751302
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ private class FlushTheEventsTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... voids) {

if (events.size() < 1) {
Log.i(TAG, "No events in the queue to send so returning.");
return null;
}

// Check for NetworkConnectivity
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
Expand Down Expand Up @@ -378,7 +383,7 @@ protected Void doInBackground(Void... voids) {
.post(body)
.build();
Response response = client.newCall(request).execute();
Log.i(TAG, "Response Code from Mapbox Events Server: " + response.code());
Log.i(TAG, "Response Code from Mapbox Events Server: " + response.code() + " for " + events.size() + " events sent in.");

// Reset Events
// ============
Expand Down

0 comments on commit 5751302

Please sign in to comment.