Class CefriumPushTransport

java.lang.Object
com.cefrium.CefriumPushTransport
Direct Known Subclasses:
CefriumRelayTransport

public abstract class CefriumPushTransport extends Object
A push service for Web Push other than Firebase Cloud Messaging.

By default a page's PushManager.subscribe() registers with FCM. An app that installs a transport with CefriumPush.setTransport(CefriumPushTransport) has every Web Push subscription served by it instead: the endpoint the page receives is the one subscribe(String, String) returns, and the transport hands each incoming message to CefriumPush.deliverMessage(Context, String, byte[]). Messages are encrypted for the page (RFC 8291), so a transport only carries them.

The cefrium-unifiedpush library provides one for UnifiedPush.

  • Constructor Details

    • CefriumPushTransport

      public CefriumPushTransport()
  • Method Details

    • subscribe

      public abstract String subscribe(String appId, String applicationServerKey) throws IOException
      Registers a subscription with the push service. Called off the main thread; may block until the service answers.
      Parameters:
      appId - identifies the subscription; pass it back to CefriumPush.deliverMessage(Context, String, byte[]) with its messages.
      applicationServerKey - the page's VAPID public key, base64url, or the sender id of a page that subscribed without one.
      Returns:
      the https URL that application servers send messages to.
      Throws:
      IOException - if the service could not register it.
    • unsubscribe

      public abstract void unsubscribe(String appId) throws IOException
      Removes a subscription from the push service. Called off the main thread.
      Throws:
      IOException - if the service could not remove it.