Android.PrintServices.PrinterDiscoverySession Class
This class encapsulates the interaction between a print service and the system during printer discovery.

See Also: PrinterDiscoverySession Members

Syntax

[Android.Runtime.Register("android/printservice/PrinterDiscoverySession", DoNotGenerateAcw=true)]
public abstract class PrinterDiscoverySession : Java.Lang.Object

Remarks

This class encapsulates the interaction between a print service and the system during printer discovery. During printer discovery you are responsible for adding discovered printers, removing previously added printers that disappeared, and updating already added printers.

During the lifetime of this session you may be asked to start and stop performing printer discovery multiple times. You will receive a call to PrinterDiscoverySession.onStartPrinterDiscovery(java.util.List<android.print.PrinterId>) to start printer discovery and a call to PrinterDiscoverySession.OnStopPrinterDiscovery to stop printer discovery. When the system is no longer interested in printers discovered by this session you will receive a call to PrinterDiscoverySession.OnDestroy at which point the system will no longer call into the session and all the session methods will do nothing.

Discovered printers are added by invoking PrinterDiscoverySession.addPrinters(java.util.List<android.print.PrinterInfo>). Added printers that disappeared are removed by invoking PrinterDiscoverySession.removePrinters(java.util.List<android.print.PrinterId>). Added printers whose properties or capabilities changed are updated through a call to PrinterDiscoverySession.addPrinters(java.util.List<android.print.PrinterInfo>). The printers added in this session can be acquired via PrinterDiscoverySession.Printers where the returned printers will be an up-to-date snapshot of the printers that you reported during the session. Printers are not persisted across sessions.

The system will make a call to PrinterDiscoverySession.onValidatePrinters(java.util.List<android.print.PrinterId>) if you need to update some printers. It is possible that you add a printer without specifying its capabilities. This enables you to avoid querying all discovered printers for their capabilities, rather querying the capabilities of a printer only if necessary. For example, the system will request that you update a printer if it gets selected by the user. When validating printers you do not need to provide the printers' capabilities but may do so.

If the system is interested in being constantly updated for the state of a printer you will receive a call to PrinterDiscoverySession.OnStartPrinterStateTracking(Android.Print.PrinterId) after which you will have to do a best effort to keep the system updated for changes in the printer state and capabilities. You also must update the printer capabilities if you did not provide them when adding it, or the printer will be ignored. When the system is no longer interested in getting updates for a printer you will receive a call to PrinterDiscoverySession.OnStopPrinterStateTracking(Android.Print.PrinterId).

Note: All callbacks in this class are executed on the main application thread. You also have to invoke any method of this class on the main application thread.

[Android Documentation]

Requirements

Namespace: Android.PrintServices
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0