23public class PrintJobMonitor
extends FileObserver
27 void onPrintJobComplete(File pdfFile);
30 private static final String WATCH_DIR =
"/sdcard/Download";
31 private static final String PREFIX =
"rdp_print_";
32 private static final String SUFFIX =
".pdf";
36 public PrintJobMonitor(
Listener listener)
38 super(WATCH_DIR, CLOSE_WRITE);
39 this.listener = listener;
42 @Override
public void onEvent(
int event, @Nullable String path)
46 if (!path.startsWith(PREFIX) || !path.endsWith(SUFFIX))
48 listener.onPrintJobComplete(
new File(WATCH_DIR, path));