LiveUpdateProgressStyleProvider
The single customization point for Pushwoosh Live Updates: supply the Notification.ProgressStyle used to render a live-update notification.
The SDK owns everything else — channel registration, the Notification.Builder, the ongoing flag, promoted-ongoing extras, large-icon download, header-time wiring, action mapping and the final NotificationManager.notify(). A custom provider can only shape the progress bar; it cannot break promoted-ongoing eligibility or skip channel setup. If a provider throws, the SDK falls back to the default style and the notification still posts.
Register an implementation via manifest meta-data:
<meta-data
android:name="com.pushwoosh.LIVE_UPDATE_STYLE_PROVIDER"
android:value="com.example.MyStyleProvider" />
Example — map the payload's segments onto the bar and mark each phase boundary with a point:
public class OrderStyleProvider implements LiveUpdateProgressStyleProvider {
public Notification.ProgressStyle createStyle(@NonNull LiveUpdateState state) {
Notification.ProgressStyle style = new Notification.ProgressStyle();
if (state.getProgress() != null) {
style.setProgress(state.getProgress());
}
style.setProgressIndeterminate(state.isProgressIndeterminate());
List<LiveUpdateSegment> segments = state.getSegments();
int boundary = 0;
for (int i = 0; i < segments.size(); i++) {
LiveUpdateSegment seg = segments.get(i);
style.addProgressSegment(
new Notification.ProgressStyle.Segment(seg.getLength()).setColor(seg.getColor()));
boundary += seg.getLength();
if (i < segments.size() - 1) {
style.addProgressPoint(new Notification.ProgressStyle.Point(boundary));
}
}
return style;
}
}
Threading &per-push contract.createStyle is invoked once per rendered push — on every start and every update (an end dismisses and does not call it) — on a worker thread. The provider is a single instance per process, so implementations must be stateless: derive the returned style only from the supplied state and keep no mutable state between calls. Vary output using getProgress, getSegments, isProgressIndeterminate, getOperation and the arbitrary payload JSON in getExtras.