3232public class TracksClient {
3333 public static final String LOGTAG = "NosaraClient" ;
3434
35- protected static final String DEFAULT_USER_AGENT = "Nosara Client for Android" ;
3635 protected static final String NOSARA_REST_API_ENDPOINT_URL_V1_1 = "https://public-api.wordpress.com/rest/v1.1/" ;
3736 protected static final int DEFAULT_EVENTS_QUEUE_THRESHOLD = 9 ;
3837 protected static final int DEFAULT_EVENTS_QUEUE_MAX_SIZE = 10000 ;
@@ -53,7 +52,7 @@ public static enum NosaraUserType {ANON, WPCOM, SIMPLENOTE, POCKETCASTS, DAYONE}
5352 final static String PROTOCOL_CONTENT_TYPE = String .format ("application/json; charset=%s" , PROTOCOL_CHARSET );
5453
5554 private final Context mContext ;
56- private String mUserAgent = TracksClient . DEFAULT_USER_AGENT ;
55+ private final String mUserAgent ;
5756 private String mRestApiEndpointURL ;
5857 private final String mTracksRestEndpointURL ;
5958 private DeviceInformation deviceInformation ;
@@ -89,6 +88,7 @@ private TracksClient(Context ctx) {
8988 mRestApiEndpointURL = NOSARA_REST_API_ENDPOINT_URL_V1_1 ;
9089 mTracksRestEndpointURL = getAbsoluteURL ("tracks/record" );
9190 deviceInformation = new DeviceInformation (ctx );
91+ mUserAgent = deviceInformation .getDeviceUserAgent ();
9292
9393 // This is the thread that reads from the "fast" (in-memory) input events queue and actually writes data to the DB.
9494 Thread bufferCopyThread = new Thread (new Runnable () {
@@ -495,11 +495,6 @@ private String getAbsoluteURL(String url) {
495495 return String .format ("%s%s" , mRestApiEndpointURL , url );
496496 }
497497
498- //Sets the User-Agent header to be sent with each future request.
499- public void setUserAgent (String userAgent ) {
500- mUserAgent = userAgent ;
501- }
502-
503498 public String getUserAgent () {
504499 return mUserAgent ;
505500 }
0 commit comments