Vladimir Arkhipov
Vladimir Arkhipov

Reputation: 169

Android: How to print to Default Print Service without Android UI?

I am trying to print to the default print service in Android 9 and it seems that I can only do it through PrintManager.print command. Unfortunately, this command pops up a view that I don't need in my flow as I am developing an automated printing app that needs no user interaction on a single print.

Quick look through PrintManager.print sources reveals that print services can be interrogated, e.g. below.

IPrintManager printManager = IPrintManager.Stub.asInterface(
    ServiceManager.getService(Context.PRINT_SERVICE));

List<PrintServiceInfo> services = printManager.getPrintServices(selectionFlags, mUserId);

However, all these goods are hidden from regular people. I can potentially use reflection to get to some of the methods, but that is a very slippery road. What options am I left with?

Upvotes: 1

Views: 473

Answers (0)

Related Questions