| java.lang.Object | |
| ↳ | mobisocial.omlib.api.OmlibApiManager |
Manages the connection to the OmletApi. A shared instance is available
as getInstance(Context).
Most apps will connect() and disconnect() as part
of their Activity or Service lifecycle. The OmletApiManager is reference counted,
and calls to connect() and disconnect() must be balanced.
Example:
/**
* Manifest needs these meta-data tags to access api key and secret
*
* <meta-data android:name="omlet.apikey"
* android:value="00108caac07d0d32ddb233e8aed0a801a9870005a88e6b692f"/>
*
* <meta-data android:name="omlet.secret"
* android:value="cce90e196a160700af542656ba8d5042b4b1645a3f875992f0f39d36d0d3a3b5"/>
*/
public class MyActivity extends Activity {
OmlibApiManager mOmletApi;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mOmletApi = OmlibApiManager.getInstance();
mOmletApi.connect(this);
}
@Override
public void onDestroy() {
super.onDestroy();
mOmletApi.disconnect(this);
mOmletApi = null;
}
public void createGroup() {
Uri feedUri = omletApi.feeds().createFeed(FeedKind.Chat);
}
public void sayHello(final Uri groupUri) {
Sendable msg = SendUtils.createText("Hello, world!");
omletApi.messaging().send(groupUri, msg);
}
}
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| interface | OmlibApiManager.ApiRunnable | ||||||||||
| enum | OmlibApiManager.Error | ||||||||||
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| String | LAST_STICKER_REFRESH | ||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public static final Executor | THREAD_POOL_EXECUTOR | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| ClientAnalyticsUtils | analytics() | ||||||||||
| OmletAuthApi |
auth()
Access APIs for managing user authentication.
| ||||||||||
| OmletBlobApi |
blobs()
Access APIs for fetching and posting large binary content.
| ||||||||||
| void |
connect()
Registers interest in a connection to the messaging server, for low-latency requests and real-time push messaging support. | ||||||||||
| void |
disconnect()
Unregisters interest for connectivity to the messaging server. | ||||||||||
| OmletFeedApi |
feeds()
Access APIs for creating and managing groups.
| ||||||||||
| static OmlibApiManager | getInstance(Context ctx) | ||||||||||
| OmletIdentityApi |
identity()
Access APIs for managing user and friend identities.
| ||||||||||
| OmletMessagingApi |
messaging()
Access APIs for sending messages in feeds.
| ||||||||||
| OmletOobApi | oob() | ||||||||||
| void | registerNetworkConnectivityListener(NetworkConnectivityListener listener) | ||||||||||
| boolean | removeNetworkConnectivityListener(NetworkConnectivityListener listener) | ||||||||||
| void |
run(OmlibApiManager.ApiRunnable runnable)
Runs an
OmlibApiManager.ApiRunnable on a background thread owned by this OmlibApiManager. | ||||||||||
| boolean | shouldApplyChinaFilters() | ||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void | onCreate() | ||||||||||
| void | onDestroy() | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
mobisocial.omlib.api.OmletApi
| |||||||||||
Registers interest in a connection to the messaging server, for low-latency requests and real-time push messaging support.
Calls to connect() and disconnect() are
reference counted and must be balanced.
Unregisters interest for connectivity to the messaging server. When no interest remains, the connection remains open for a short amount of time before terminating.
Calls to connect() and disconnect() are reference counted and must be balanced.
Runs an OmlibApiManager.ApiRunnable on a background thread owned by this OmlibApiManager.
The Api may take some time to initialize-- for example to create or upgrade the database or
generate user keys. This initialization happens when the OmlibApiManager is first
accessed, on the same background thread used here.