- Fix: This fix gracefully retries temporary HTTP errors such as 5xx server errors. Previously such HTTP errors were not being retried.
-
New: Allow setting
Stringmessage and anonymous IDs. Previously only UUIDs were accepted. This is a breaking API change and might require you to update your code if you were accessing themessageIdoranonymousIdin a transformer or interceptor. -
New: Set a custom user-agent for HTTP requests. The default user agent is "analytics-java/version". This user agent is also customizable and can be override for special cases.
final Analytics analytics = Analytics.builder(writeKey) //
.userAgent("custom user agent")
.build();
- Fix: Previously the version was being sent as "analytics/version" instead of simply "version".
- New: Make endpoint configurable.
- New: Allow setting a custom message ID.
- New: Allow setting a custom timestamp.
- Fix: Previously, logging Retrofit messages could cause errors if the message contained formatting directives.
- New: Add ability to set multiple Callback instances.
- New: Add plugin API.
class LoggingPlugin implements Plugin {
@Override public void configure(Analytics.Builder builder) {
builder.log(new Log() {
@Override public void print(Level level, String format, Object... args) {
System.out.println(level + ":\t" + String.format(format, args));
}
@Override public void print(Level level, Throwable error, String format, Object... args) {
System.out.println(level + ":\t" + String.format(format, args));
System.out.println(error);
}
});
builder.callback(new Callback() {
@Override public void success(Message message) {
System.out.println("Uploaded " + message);
}
@Override public void failure(Message message, Throwable throwable) {
System.out.println("Could not upload " + message);
System.out.println(throwable);
}
});
}
}
final Analytics analytics = Analytics.builder(writeKey) //
.plugin(new LoggingPlugin())
.build();
- Fix: Correctly format and parse dates as per ISO 8601.
- New: Add Page API.
- Fix: Force ISO 8601 format for dates.
- Use a single thread by default to upload events in the background. Clients can still set their own executor to override this behaviour.
- New: Add Callback API.
- Fix: Backpressure behaviour. Enqueuing events on a full queue will block instead of throwing an exception.
- Removed Guava dependency.
- Internal: Rename enums with lowercase.