Skip to content

Commit

Permalink
add ACRA version in field User-Agent
Browse files Browse the repository at this point in the history
for define client ACRA version in php use variable $_SERVER['HTTP_USER_AGENT']
  • Loading branch information
DenisZhadan committed Apr 20, 2016
1 parent a78a101 commit dec000f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/acra/util/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;

import ch.acra.acra.BuildConfig;

import static org.acra.ACRA.LOG_TAG;

public final class HttpRequest {
Expand Down Expand Up @@ -118,7 +120,7 @@ public void send(@NonNull Context context, @NonNull URL url, @NonNull Method met
urlConnection.setReadTimeout(socketTimeOut);

// Set Headers
urlConnection.setRequestProperty("User-Agent", "Android");
urlConnection.setRequestProperty("User-Agent", String.format("Android ACRA %1$s", BuildConfig.VERSION_NAME)); //sent ACRA version to server
urlConnection.setRequestProperty("Accept",
"text/html,application/xml,application/json,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
urlConnection.setRequestProperty("Content-Type", type.getContentType());
Expand Down

0 comments on commit dec000f

Please sign in to comment.