|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectoak.nfc.TagWriter
public class TagWriter
Created with IntelliJ IDEA. User: ericrichardson Date: 11/8/12 Time: 1:25 PM To change this template use File | Settings | File Templates.
| Constructor Summary | |
|---|---|
TagWriter(android.content.Context context,
String mimeType,
android.app.Activity activity,
android.app.PendingIntent pendingIntent,
android.content.IntentFilter[] intentFilters)
The constructor for a write tag object |
|
| Method Summary | |
|---|---|
void |
clearPushMessage()
A method to turn clear out the previous message to be pushed. |
void |
createMimeType(String name)
a method to create a MimeType that the application will use when writing to a tag so that it knows which application / activity to bring up when the tag is touched. |
void |
disableNdefExchangeMode()
Call to disable any sort of exchange between NDEF devices. |
void |
disableTagWriteMode()
Disables the tag writing mode so that there is no confusion for the application as to whether it's about to write to a tag or not. |
void |
enableNdefExchangeMode()
Call to enable an exchange between NDEF devices during the activity with the message to be written. |
void |
enableTagWriteMode()
Enables the tag writing mode so that the application knows that it is ready to write something to a tag. |
byte[] |
getBytePayload()
Gets the payload for a message from the array of NDEFmessages and then sets mPayload to that value and returns it. |
android.nfc.Tag |
getDetectedTag(android.content.Intent intent)
a getter for a detected tag from an intent. |
android.nfc.NdefMessage |
getMessageFromArray()
Gets the first message in the array of messages and sets the current message field to that value. |
android.nfc.NdefMessage |
getNdefMessage()
A getter for the current NdefMessage. |
android.nfc.NdefMessage[] |
getNdefMessages()
A getter for the NdefMessages array. |
android.nfc.NdefMessage[] |
getNdefMessages(android.content.Intent intent)
Gets the NdefMessage array from a tag when it's discovered or from an NDEF device. |
String |
getPayloadString()
A helper method to get the string version of whatever the current ndef message is. |
android.nfc.NdefMessage |
getTextViewAsNdef(android.widget.TextView view)
Gets the message from a text view and turns it into an NDEF Message and returns it as well as setting the message field. |
boolean |
isNdefDiscovered(android.content.Intent intent)
A method that determines if there's an NDEF action discovered from an intent. |
boolean |
isTagDiscovered(android.content.Intent intent)
A method that determines if there's an NFC tag discovered from an intent. |
boolean |
isWriteMode()
A getter for the boolean writeMode. |
void |
setMessage(byte[] bytes)
A method to create an NDEF message from a byte array and sets the current message field to that value. |
void |
setMessage(String str)
A method that will create an NDEF message from a string and set the current message to that value. |
void |
setPayloadString()
a helper method to set a string from the payload of a single message. |
boolean |
writeToTag(android.nfc.NdefMessage aMessage,
android.nfc.Tag tag)
A big method that writes an NDEF message to a tag or displays a toast message as to why it failed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TagWriter(android.content.Context context,
String mimeType,
android.app.Activity activity,
android.app.PendingIntent pendingIntent,
android.content.IntentFilter[] intentFilters)
context - the context needed to create the NfcAdapter. (The activity)mimeType - the mimetype for the applicationactivity - the activity that will be using this objectpendingIntent - the pending intent that handles all nfc intentsintentFilters - the filters needed for writing to a tag| Method Detail |
|---|
public void enableNdefExchangeMode()
public void disableNdefExchangeMode()
public android.nfc.NdefMessage getTextViewAsNdef(android.widget.TextView view)
view - The textView that contains the text to be turned into a message.
public void setPayloadString()
public String getPayloadString()
public void clearPushMessage()
public byte[] getBytePayload()
public android.nfc.NdefMessage getNdefMessage()
public android.nfc.NdefMessage[] getNdefMessages()
public android.nfc.NdefMessage getMessageFromArray()
public android.nfc.NdefMessage[] getNdefMessages(android.content.Intent intent)
intent - The intent that contains the action that is hopefully either ACTION_TAG_DISCOVERED or ACTION_NDEF_DISCOVERED
public android.nfc.Tag getDetectedTag(android.content.Intent intent)
intent - the intent that contains the tag
public boolean isWriteMode()
public boolean isNdefDiscovered(android.content.Intent intent)
intent - the intent that might contain the NDEF Action.
public boolean isTagDiscovered(android.content.Intent intent)
intent - the intent that might contain a Tag Discovered action
public void enableTagWriteMode()
public void disableTagWriteMode()
public void createMimeType(String name)
name - the name of the application that will be tacked on to the mimeType.public void setMessage(String str)
str - The String that will be used to create an NDEF message.public void setMessage(byte[] bytes)
bytes - the byte array that will be used to create the NDEF message.
public boolean writeToTag(android.nfc.NdefMessage aMessage,
android.nfc.Tag tag)
aMessage - the message to be written to the tag.tag - the tag that the message is being written to.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||