# Class PushSubscription

java.lang.Object
com.codename1.push.PushSubscription

public final class PushSubscription extends Object

Immutable native registration produced by a push transport.

The token is opaque provider data. Applications should send the complete subscription to their server and must not parse, truncate, or use the token as a user identity. Providers can rotate tokens, so a later registration for the same installation replaces the earlier value.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PushSubscription(String transportId, String token, String platform, String installationId, long expiresAt, List<String> capabilities)`
  Creates a subscription, primarily for custom `PushTransport` implementations.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<String>`
  `getCapabilities()`
  Returns transport capability identifiers.
  `long`
  `getExpiresAt()`
  Returns the subscription expiry time.
  `String`
  `getInstallationId()`
  Returns the stable ID for this application installation.
  `String`
  `getPlatform()`
  Returns the Codename One platform name reported at registration.
  `String`
  `getToken()`
  Returns the opaque native provider token.
  `String`
  `getTransportId()`
  Returns the provider identifier used for delivery routing.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PushSubscription

    public PushSubscription(String transportId, String token, String platform, String installationId, long expiresAt, List<String> capabilities)
    Creates a subscription, primarily for custom `PushTransport` implementations.
    Parameters:
      `transportId` - stable provider identifier
      `token` - opaque native provider token
      `platform` - Codename One platform name
      `installationId` - stable application installation identifier
      `expiresAt` - expiration time in epoch milliseconds, or `0` when the provider supplies no expiry
      `capabilities` - immutable capability identifiers, or `null`
    Throws:
      `IllegalArgumentException` - if `transportId` or `token` is null, blank, or has surrounding whitespace

- ## Method Details

  - ### getTransportId

    public String getTransportId()
    Returns the provider identifier used for delivery routing.
    Returns:
      the transport identifier

  - ### getToken

    public String getToken()
    Returns the opaque native provider token.
    Returns:
      the native token

  - ### getPlatform

    public String getPlatform()
    Returns the Codename One platform name reported at registration.
    Returns:
      the platform name

  - ### getInstallationId

    public String getInstallationId()
    Returns the stable ID for this application installation.
    Returns:
      the installation identifier

  - ### getExpiresAt

    public long getExpiresAt()
    Returns the subscription expiry time.
    Returns:
      epoch milliseconds, or `0` when no expiry is known

  - ### getCapabilities

    public List<String> getCapabilities()
    Returns transport capability identifiers.
    Returns:
      an immutable, possibly empty list