Skip to content

Instantly share code, notes, and snippets.

@afjk
Last active December 18, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afjk/5791909 to your computer and use it in GitHub Desktop.
Save afjk/5791909 to your computer and use it in GitHub Desktop.
StickyNotesActivity::onNewIntent
@Override
protected void onNewIntent(Intent intent) {
// NDEF exchange mode
if (!mWriteMode && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
NdefMessage[] msgs = getNdefMessages(intent);
promptForContent(msgs[0]);
}
// Tag writing mode
if (mWriteMode && NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
writeTag(getNoteAsNdef(), detectedTag);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment