public class OfflineClient extends Client
NOTE: Requires Algolia's SDK. The enableOfflineMode(String) method must be called with a valid license
key prior to calling any offline-related method.
Client.MultipleQueriesStrategyAbstractClient.LibraryVersion| Constructor and Description |
|---|
OfflineClient(android.content.Context context,
String applicationID,
String apiKey)
Construct a new offline-enabled API client.
|
OfflineClient(android.content.Context context,
String applicationID,
String apiKey,
File dataDir)
Construct a new offline-enabled API client.
|
OfflineClient(android.content.Context context,
String applicationID,
String apiKey,
File dataDir,
String[] hosts)
Construct a new offline-enabled API client.
|
| Modifier and Type | Method and Description |
|---|---|
Request |
deleteIndexOfflineAsync(String indexName,
CompletionHandler completionHandler)
Delete an offline index.
|
void |
enableOfflineMode(String licenseData)
Enable the offline mode.
|
android.content.Context |
getContext() |
File |
getDefaultDataDir()
Get the default data directory.
|
MirroredIndex |
getIndex(String indexName)
Obtain a mirrored index.
|
OfflineIndex |
getOfflineIndex(String indexName)
Obtain a purely offline index.
|
File |
getRootDataDir()
Get the path to directory where the local data is stored.
|
boolean |
hasOfflineData(String name)
Test if an index has offline data on disk.
|
MirroredIndex |
initIndex(String indexName)
Deprecated.
You should now use
getIndex(String), which re-uses instances with the same name. |
Request |
listIndexesOfflineAsync(CompletionHandler completionHandler)
List existing offline indices.
|
Request |
moveIndexOfflineAsync(String srcIndexName,
String dstIndexName,
CompletionHandler completionHandler)
Move an existing offline index.
|
batchAsync, batchAsync, copyIndexAsync, copyIndexAsync, deleteIndexAsync, deleteIndexAsync, getApplicationID, listIndexesAsync, listIndexesAsync, moveIndexAsync, moveIndexAsync, multipleQueriesAsync, multipleQueriesAsyncaddUserAgent, getConnectTimeout, getHeader, getHostDownDelay, getReadHosts, getReadTimeout, getSearchTimeout, getUserAgents, getWriteHosts, hasUserAgent, removeUserAgent, setCompletionExecutor, setConnectTimeout, setHeader, setHostDownDelay, setHosts, setReadHosts, setReadTimeout, setSearchTimeout, setWriteHostspublic OfflineClient(@NonNull
android.content.Context context,
@NonNull
String applicationID,
@NonNull
String apiKey)
public OfflineClient(@NonNull
android.content.Context context,
@NonNull
String applicationID,
@NonNull
String apiKey,
File dataDir)
context - An Android context.applicationID - See Client.apiKey - See Client.dataDir - Path to the directory where the local data will be stored. If null, the default directory will
be used. See getDefaultDataDir().public OfflineClient(@NonNull
android.content.Context context,
@NonNull
String applicationID,
@NonNull
String apiKey,
File dataDir,
String[] hosts)
context - An Android context.applicationID - See Client.apiKey - See Client.dataDir - Path to the directory where the local data will be stored. If null, the default directory will
be used. See getDefaultDataDir().hosts - See Client.public MirroredIndex initIndex(@NonNull String indexName)
getIndex(String), which re-uses instances with the same name.MirroredIndex, mirroring is deactivated
by default.@NonNull public MirroredIndex getIndex(@NonNull String indexName)
MirroredIndex, mirroring is
deactivated by default.getIndex in class ClientindexName - The name of the index.getOfflineIndex(String).public OfflineIndex getOfflineIndex(@NonNull String indexName)
indexName - The name of the index.getIndex(String).@NonNull public File getRootDataDir()
public void enableOfflineMode(@NonNull
String licenseData)
licenseData - License for Algolia's SDK.public File getDefaultDataDir()
@NonNull public android.content.Context getContext()
public boolean hasOfflineData(@NonNull
String name)
MirroredIndex and OfflineIndex instances.
**Warning:** This method is synchronous!name - The index's name.public Request listIndexesOfflineAsync(@NonNull CompletionHandler completionHandler)
MirroredIndex and OfflineIndex instances.completionHandler - The listener that will be notified of the request's outcome.public Request deleteIndexOfflineAsync(@NonNull String indexName, CompletionHandler completionHandler)
MirroredIndex and OfflineIndex instances.indexName - Name of index to delete.public Request moveIndexOfflineAsync(@NonNull String srcIndexName, @NonNull String dstIndexName, CompletionHandler completionHandler)
MirroredIndex and OfflineIndex instances.srcIndexName - Name of index to move.dstIndexName - The new index name.completionHandler - The listener that will be notified of the request's outcome.