Samsung Web API enables you to search for content, such as images, videos, or music located on the local device storage, using the Content API. You can also perform content management tasks, such as viewing and updating content metadata.
The main features of Content API include:
- Content retrieval
The Content API uses the same ContentManager interface instance for all content-related functionalities. The instance provides higher efficiency by performing batch operations on content items.
You can browse and search for content directories and content using the getDirectories() and find() methods of the ContentManager interface. When searching for content items, you can create attribute filters, attribute range filters, and composite filters based on specific filter attributes of the ContentManager interface. You can also sort the search results.
- Content management
You can view and edit content item details. The details are common file information and metadata attributes of the media file.
To view content item details, use the find() method. To update some attributes of a content item, for example its rating, use the update() method.
For more information on the content attributes, see the Content Full WebIDL Reference.
If a content item is copied or moved, you cannot find it because a scan is not performed automatically. To retrieve the copied or moved item, use the find() method after calling the scanFile() method.
Note You can only view (and not update) the read-only attributes.
- Content change notifications
You can keep the content in your application synchronized with an external content manager by receiving notifications in your application when the content changes. The setChangeListener() method of the ContentManager interface registers a change listener. You can use the ContentChangeCallback interface to define listener event handlers for receiving the notifications.
|Using the batch mode with a large number of operations can block other database operations, such as add or remove. To ensure that all database operations are performed and to improve overall application performance, break the batch operation down into multiple smaller batch operations. For example, break down a batch of 100 update requests into 10 batch operations that update 10 records at a time.|