Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Interface Subscription

On this page

  • io.realm.mongodb.sync
  • Method Summary
  • Method Detail
  • create
  • getCreatedAt
  • getName
  • getObjectType
  • getQuery
  • getUpdatedAt

A subscription defines a specific server query and its metadata. The result of this query is continuously being synchronized with the device as long as the subscription is part of a SubscriptionSet with a state of SubscriptionSet.State.COMPLETE . Subscriptions are immutable once created, but they can be updated by using a MutableSubscriptionSet.addOrUpdate(Subscription) .

Modifier and Type
Method and Description
public static Subscription

Create an unmanaged anonymous subscription for a flexible sync enabled Realm.

public static Subscription

Create an unmanaged named subscription for a flexible sync enabled Realm.

public Date

Returns the timestamp for when this subscription was persisted.

public String

Returns the name of subscription or null if no name was defined.

public String

Returns the type that is being queried.

public String

Returns the subscription query that is running on objects of type getObjectType() .

public Date

Returns the timestamp for when a persisted subscription was updated.

Create an unmanaged anonymous subscription for a flexible sync enabled Realm. The subscription will not take effect until it has been stored using either MutableSubscriptionSet.add(Subscription) or MutableSubscriptionSet.addOrUpdate(Subscription) .

Parameters

  • query - the query that is subscribed to. Note, subscription queries have restrictions compared to normal queries.

Returns

the unmanaged subscription.

public static Subscription create (
)

Create an unmanaged named subscription for a flexible sync enabled Realm. The subscription will not take effect until it has been stored using either MutableSubscriptionSet.add(Subscription) or MutableSubscriptionSet.addOrUpdate(Subscription) .

Parameters

  • name - the name of the subscription

  • query - the query that is subscribed to. Note, subscription queries have restrictions compared to normal queries.

Returns

the unmanaged subscription.

public Date getCreatedAt ()

Returns the timestamp for when this subscription was persisted. This will return null until the Subscription has been added using either MutableSubscriptionSet.add(Subscription) or MutableSubscriptionSet.addOrUpdate(Subscription) .

Returns

the time this subscription was persisted, or null if the subscription hasn't been persisted yet.

public String getName ()

Returns the name of subscription or null if no name was defined.

Returns

the name of the subscription.

Returns the type that is being queried.

Returns

the type that is being queried.

public String getQuery ()

Returns the subscription query that is running on objects of type getObjectType() .

Returns

the query covered by this subscription.

public Date getUpdatedAt ()

Returns the timestamp for when a persisted subscription was updated. This will return null until the Subscription has been added using either MutableSubscriptionSet.add(Subscription) or MutableSubscriptionSet.addOrUpdate(Subscription) .

Returns

the time this subscription was updated, or null if the subscription hasn't been persisted yet.

← Enum ProgressMode