Mark Allison

Android NFC: Write an NdefTag

Mark Allison | Jun 25, 2018

Android NFC - Reading/Writing (Part 4)

In this screen cast we’ll further build upon the app from the last cast where we got foreground dispatch working to handle tag discovery events within a resumed Activity. We’ll look at how we can construct an NdefRecord, and an NdefMessage and write this to a tag. We’ll also look at the difference in writing to an Ndef tag and an un-formatted NdefFormatable tag.

For the More Curious...

Android NFC

Subscribers Only

Transcripts are for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.

Subscribers Only

Project files are only available for subscribers. Create an account today to access our collection of screencasts, skill packs, and more.

Need Help?

If you get stuck, try starting a discussion with Big Nerd Ranch experts in the community tab.

Android NFC

This screencast is part of a skill pack called Android NFC.

Android NFC: Launch Activity

4 minutes

In the first screencast of this series we’ll cover the basics of NFC tags introducing NDEF and the Android tag dispatch system. We’ll look at how to add an intent-filter to the Manifest entry for a given Activity to enable that Activity to be launched when a matching tag is detected by the device.

Android NFC: Read Payload Data from a Tag

5 minutes

In the second screencast of this series, we’ll build upon the app we started in the first screencast and demonstrate how we can retrieve the payload of the tag within the Activity which was launched when the device detected a matching tag. Along the way we’ll explore some of the internals of how NFC tags are structured.

Android NFC: Foreground Dispatch

5 minutes

In the third screencast of the Android NFC series, we’ll continue to build on the app we’ve been working on in the series so far. Now we’ll begin preparations to write to a tag by creating a new Activity which will use foreground dispatch to get notifications of any tags which are detected while it is in resumed state.

Android NFC: Write an NdefTag

6 minutes

In this screen cast we’ll further build upon the app from the last cast where we got foreground dispatch working to handle tag discovery events within a resumed Activity. We’ll look at how we can construct an NdefRecord, and an NdefMessage and write this to a tag. We’ll also look at the difference in writing to an Ndef tag and an un-formatted NdefFormatable tag.

Android NFC: Android Application Records

3 minutes

In the final screen cast of the series we’ll return to the Android chooser behavior which asks the user which application they wish to use to handle a newly discovered tag. We’ll then look at how we can add an Android Application Record to our NdefMessage which will effectively specify that our app will handle the tag and bypass the chooser. While it is very light on code, the concepts do require a little explanation to make the code changes understandable.

Related Screencasts

Explore other screencasts related to this topic.

Android NFC: Read Payload Data from a Tag

5 minutes

In the second screencast of this series, we’ll build upon the app we started in the first screencast and demonstrate how we can retrieve the payload of the tag within the Activity which was launched when the device detected a matching tag. Along the way we’ll explore some of the internals of how NFC tags are structured.

Android NFC: Android Application Records

3 minutes

In the final screen cast of the series we’ll return to the Android chooser behavior which asks the user which application they wish to use to handle a newly discovered tag. We’ll then look at how we can add an Android Application Record to our NdefMessage which will effectively specify that our app will handle the tag and bypass the chooser. While it is very light on code, the concepts do require a little explanation to make the code changes understandable.

Kotlin and Android Lifecycles

6 minutes

What are some strategies for dealing with Kotlin and Android Lifecycles? In this screencast, cast you'll learn how Android Lifecycles appear to inhibit some core behaviors of Kotlin.

Android NFC: Launch Activity

4 minutes

In the first screencast of this series we’ll cover the basics of NFC tags introducing NDEF and the Android tag dispatch system. We’ll look at how to add an intent-filter to the Manifest entry for a given Activity to enable that Activity to be launched when a matching tag is detected by the device.

Kotlin Nullability

5 minutes

In this screencast, we'll learn how to take a Java class converted to Kotlin using the conversion tool built in Android Studio, and apply some better null safety to the code learning about null safety along the way.

Android NFC: Foreground Dispatch

5 minutes

In the third screencast of the Android NFC series, we’ll continue to build on the app we’ve been working on in the series so far. Now we’ll begin preparations to write to a tag by creating a new Activity which will use foreground dispatch to get notifications of any tags which are detected while it is in resumed state.