Prerequisites
- A working Android quickstart
- Cloud Filters enabled for the project
Request the catalog
NosmaiCloud.fetch can perform network and disk work. Run it away from the main thread:
NosmaiCloud.FilterQuery query = new NosmaiCloud.FilterQuery();
query.filterType = "effects";
query.page = 1;
query.limit = 20;
cloudExecutor.execute(() -> {
boolean success = NosmaiCloud.fetch(query);
List<NosmaiCloud.Item> items = success
? NosmaiCloud.list()
: Collections.emptyList();
mainHandler.post(() -> render(items));
});
Download and apply
NosmaiCloud.download(item.id, (id, success, localPath, error) -> {
if (success && localPath != null && !localPath.isEmpty()) {
NosmaiEffects.applyEffect(localPath, effectCallback);
}
});
Use NosmaiCloud.cachedList() for immediate cached UI, and deduplicate repeated taps by identifier.
Handle cache eviction
The SDK cache has no documented permanent TTL. Check cachedList() or the download result at the time of use. If the package is missing after operating- system storage cleanup, download it again and replace the stored local path. Keep the cloud identifier as the durable application reference.
Verify it worked
Reopen the sheet and apply the cached item without another network download.
Common errors
| Symptom | Fix |
|---|---|
| Camera UI freezes | Move catalog fetch away from the main thread |
| Old response replaces a new tab | Track request ownership and ignore stale completion |
| Repeated taps create work | Keep a thread-safe in-flight identifier set |