PrintJobInfo


public final class PrintJobInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.print.PrintJobInfo


This class represents the description of a print job. The print job state includes properties such as its id, print attributes used for generating the content, and so on. Note that the print jobs state may change over time and this class represents a snapshot of this state.

Summary

Nested classes

class PrintJobInfo.Builder

Builder for creating a PrintJobInfo

Constants

int STATE_BLOCKED

Print job state: The print job is blocked.

int STATE_CANCELED

Print job state: The print job is canceled.

int STATE_COMPLETED

Print job state: The print job is successfully printed.

int STATE_CREATED

Print job state: The print job is being created but not yet ready to be printed.

int STATE_FAILED

Print job state: The print job was printing but printing failed.

int STATE_QUEUED

Print job state: The print jobs is created, it is ready to be printed and should be processed.

int STATE_STARTED

Print job state: The print job is being printed.

Inherited constants

int CONTENTS_FILE_DESCRIPTOR

Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor.

int PARCELABLE_WRITE_RETURN_VALUE

Flag for use with writeToParcel(Parcel, int): the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)".

Fields

public static final Creator<PrintJobInfo> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int getAdvancedIntOption(String key)

Gets the value of an advanced (printer specific) print option.

String getAdvancedStringOption(String key)

Gets the value of an advanced (printer specific) print option.

PrintAttributes getAttributes()

Gets the print job attributes.

int getCopies()

Gets the number of copies.

long getCreationTime()

Gets the wall time in millisecond when this print job was created.

PrintJobId getId()

Gets the unique print job id.

String getLabel()

Gets the human readable job label.

PageRange[] getPages()

Gets the included pages.

PrinterId getPrinterId()

Gets the unique target printer id.

int getState()

Gets the current job state.

boolean hasAdvancedOption(String key)

Gets whether this job has a given advanced (printer specific) print option.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

abstract void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Constants

STATE_BLOCKED

Added in API level 19
public static final int STATE_BLOCKED

Print job state: The print job is blocked.

Next valid states: STATE_FAILED, STATE_CANCELED, STATE_STARTED

Constant Value: 4 (0x00000004)

STATE_CANCELED

Added in API level 19
public static final int STATE_CANCELED

Print job state: The print job is canceled. This is a terminal state.

Next valid states: None

Constant Value: 7 (0x00000007)

STATE_COMPLETED

Added in API level 19
public static final int STATE_COMPLETED

Print job state: The print job is successfully printed. This is a terminal state.

Next valid states: None

Constant Value: 5 (0x00000005)

STATE_CREATED

Added in API level 19
public static final int STATE_CREATED

Print job state: The print job is being created but not yet ready to be printed.

Next valid states: STATE_QUEUED

Constant Value: 1 (0x00000001)

STATE_FAILED

Added in API level 19
public static final int STATE_FAILED

Print job state: The print job was printing but printing failed.

Next valid states: STATE_CANCELED, STATE_STARTED

Constant Value: 6 (0x00000006)

STATE_QUEUED

Added in API level 19
public static final int STATE_QUEUED

Print job state: The print jobs is created, it is ready to be printed and should be processed.

Next valid states: STATE_STARTED, STATE_FAILED, STATE_CANCELED

Constant Value: 2 (0x00000002)

STATE_STARTED

Added in API level 19
public static final int STATE_STARTED

Print job state: The print job is being printed.

Next valid states: STATE_COMPLETED, STATE_FAILED, STATE_CANCELED, STATE_BLOCKED

Constant Value: 3 (0x00000003)

Fields

CREATOR

Added in API level 19
public static final Creator<PrintJobInfo> CREATOR

Public methods

describeContents

Added in API level 19
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getAdvancedIntOption

Added in API level 26
public int getAdvancedIntOption (String key)

Gets the value of an advanced (printer specific) print option.

Parameters
key String: The option key.

Returns
int The option value.

getAdvancedStringOption

Added in API level 26
public String getAdvancedStringOption (String key)

Gets the value of an advanced (printer specific) print option.

Parameters
key String: The option key.

Returns
String The option value.

getAttributes

Added in API level 19
public PrintAttributes getAttributes ()

Gets the print job attributes.

Returns
PrintAttributes The attributes. This value cannot be null.

getCopies

Added in API level 19
public int getCopies ()

Gets the number of copies.

Returns
int The number of copies or zero if not set. Value is 0 or greater

getCreationTime

Added in API level 19
public long getCreationTime ()

Gets the wall time in millisecond when this print job was created.

Returns
long The creation time in milliseconds.

getId

Added in API level 19
public PrintJobId getId ()

Gets the unique print job id.

Returns
PrintJobId The id. This value may be null.

getLabel

Added in API level 19
public String getLabel ()

Gets the human readable job label.

Returns
String The label. This value cannot be null.

getPages

Added in API level 19
public PageRange[] getPages ()

Gets the included pages.

Returns
PageRange[] The included pages or null if not set.

getPrinterId

Added in API level 19
public PrinterId getPrinterId ()

Gets the unique target printer id.

Returns
PrinterId The target printer id. This value may be null.

getState

Added in API level 19
public int getState ()

Gets the current job state.

hasAdvancedOption

Added in API level 26
public boolean hasAdvancedOption (String key)

Gets whether this job has a given advanced (printer specific) print option.

Parameters
key String: The option key.

Returns
boolean Whether the option is present.

toString

Added in API level 19
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 19
public void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Parameters
parcel Parcel: The Parcel in which the object should be written. This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES