IReaderService
com.rvi.service.IReaderService · Interface · SocialCard 1.0.3
Read, encode and write NDEF through a single card connection.
When to use it
Section titled “When to use it”Use this interface as the type your application depends on. Call connect() before card I/O and use try-with-resources to release the connection. encodeURI() and encodeURIs() work before you connect.
Java example
Section titled “Java example”try (final IReaderService reader = ReaderService.create()) { final NDefMessage message = reader.encodeURI("https://rithush.dev"); reader.connect(); reader.write(message); System.out.println(reader.readContents());}Java imports
import com.rvi.domain.NDefMessage;import com.rvi.service.IReaderService;import com.rvi.service.ReaderService;Use a test tag whose existing contents you can replace.
How it works
Section titled “How it works”read() returns validated NDEF bytes. The default readContents() decodes all supported records and readURIs() extracts links in order. writeURI() encodes a single URI and calls write(), which replaces the message and verifies it by reading the tag back. disconnect() releases the connection explicitly and can be called more than once.
Related API
Section titled “Related API”ReaderService · NDefMessage · NDefDecoder · CardCapacityException