public final class Telepat
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Close the current Telepat instance.
|
OctopusApi |
getAPIInstance()
Get access to an Retrofit instance that is able to communicate with the Telepat Sync API
|
java.util.Map<java.lang.Integer,TelepatContext> |
getContexts()
Get a Map of all curently active contexts for the Telepat Application
|
TelepatInternalDB |
getDBInstance()
Get access to an instance controlling the internal storage DB
|
java.lang.String |
getDeviceLocalIdentifier()
Get a unique device identifier.
|
static Telepat |
getInstance() |
Channel |
getSubscribedChannel(java.lang.String channelIdentifier)
Get the
Channel instance of a locally registered channel. |
void |
initialize(android.content.Context context,
java.lang.String telepatEndpoint,
java.lang.String clientApiKey,
java.lang.String clientAppId,
java.lang.String senderId) |
void |
login(java.lang.String fbToken)
Send a Telepat Sync API call for logging in a user
|
void |
logout()
Send a Telepat Sync API call for logging out the current user.
|
void |
registerDevice(java.lang.String regId,
boolean shouldUpdateBackend)
Send the Telepat Sync API a device registration request
|
void |
registerSubscription(Channel mChannel)
Locally register an active subscription to a Telepat Channel with the Telepat SDK instance
(new channel objects register themselves automatically)
|
void |
removeSubscription(Channel mChannel)
Remove a locally registered subscription of a Telepat Channel object (this does not send any
notifications to the Telepat Sync API
|
void |
setDeviceLocalIdentifier(java.lang.String udid)
Set the unique device identifier sent to the Telepat cloud.
|
Channel |
subscribe(TelepatContext context,
java.lang.String modelName,
OnChannelEventListener listener,
java.lang.Class type)
Create a new subscription to a Telepat channel
|
public static Telepat getInstance()
public TelepatInternalDB getDBInstance()
TelepatInternalDB
public OctopusApi getAPIInstance()
OctopusApi
instancepublic void initialize(android.content.Context context, java.lang.String telepatEndpoint, java.lang.String clientApiKey, java.lang.String clientAppId, java.lang.String senderId)
public void destroy()
public void registerDevice(java.lang.String regId, boolean shouldUpdateBackend)
regId
- A GCM token for the current deviceshouldUpdateBackend
- If true, an update should be sent to the Telepat cloud instance
regardless of the state of the token (new/already sent)public void login(java.lang.String fbToken)
fbToken
- A Facebook OAUTH tokenpublic void logout()
public Channel subscribe(TelepatContext context, java.lang.String modelName, OnChannelEventListener listener, java.lang.Class type)
context
- The context ID where the desired objects live inmodelName
- The model name of the desired objectslistener
- An object implementing OnChannelEventListener. All channel events will be sent
to this object.type
- The desired Java class of the objects that will be emitted in this channel (should
extend the TelepatBaseModel class)Channel
object with the specified characteristicspublic java.util.Map<java.lang.Integer,TelepatContext> getContexts()
public void removeSubscription(Channel mChannel)
mChannel
- The channel instancepublic void registerSubscription(Channel mChannel)
mChannel
- The channel object to be registeredpublic Channel getSubscribedChannel(java.lang.String channelIdentifier)
Channel
instance of a locally registered channel.channelIdentifier
- A properly formatted string of the channel identifier.Channel
instancepublic java.lang.String getDeviceLocalIdentifier()
public void setDeviceLocalIdentifier(java.lang.String udid)
udid
- the desired UDID