Header Notice

Winter is here! Check out the winter wonderlands at these 5 amazing winter destinations in Montana

How To Read RFID Tags With Android


Modified: December 28, 2023

by Evelyn Bittner



RFID (Radio Frequency Identification) technology is widely used in various industries, including transportation, logistics, retail, and healthcare. It allows for automatic identification and tracking of objects through the use of radio waves. With the increasing popularity of Android devices, it is now easier than ever to read RFID tags using your smartphone or tablet.


In this article, we will guide you through the process of reading RFID tags with an Android device. We will provide step-by-step instructions on setting up the necessary hardware, installing the Android SDK, configuring permissions, creating a new Android project, and writing the code to read RFID tags.


Reading RFID tags with an Android device opens up a world of possibilities for mobile applications. You can use it for inventory management, access control in buildings, tracking assets, and much more. Whether you are a developer looking to incorporate RFID functionality into your Android app or an enthusiast interested in exploring the capabilities of RFID technology, this article is for you.


Before we dive into the technical aspects, let’s briefly cover the hardware you will need to get started.


Required Hardware

To read RFID tags with an Android device, you will need the following hardware:

  1. Android device: You can use a smartphone or tablet running on Android OS. Make sure it has a built-in NFC (Near Field Communication) module, as NFC is commonly used for RFID tag reading.
  2. RFID reader: You will need an external RFID reader that is compatible with Android devices. Look for an RFID reader that supports the frequency range of the RFID tags you plan to read (e.g., 125 kHz or 13.56 MHz).
  3. USB OTG (On-The-Go) cable: Since most RFID readers use USB connection, you will need a USB OTG cable to connect the reader to your Android device.
  4. RFID tags: Depending on your use case, you will need specific RFID tags that are compatible with the RFID reader you are using. Make sure to choose the appropriate frequency and format (e.g., sticker tags, keychain tags, or wristband tags).

It is important to ensure that the RFID reader you choose is compatible with the Android SDK and supports the necessary protocols for reading RFID tags. Some RFID readers come with their own SDKs or APIs, which can simplify the integration process with your Android app.


Once you have gathered all the required hardware, you are ready to set up the Android development environment and configure the RFID reader. The next section will guide you through the process of installing the Android SDK.


Installing the Android SDK

Before you can start developing Android applications, you need to install the Android Software Development Kit (SDK) on your computer. The Android SDK provides the tools and libraries necessary for building and testing Android apps. Here’s how you can install it:

  1. Go to the official Android developer website (https://developer.android.com) and navigate to the “Downloads” section.
  2. Click on the “SDK Tools Only” download link to download the SDK command-line tools package.
  3. Once the download is complete, extract the contents of the downloaded ZIP file to a location on your computer.
  4. Add the SDK’s “tools” and “platform-tools” directories to your system’s PATH environment variable.
  5. Open a command prompt or terminal window and run the “android” command to launch the Android SDK Manager.
  6. In the SDK Manager, select the Android SDK Platform and any additional components you want to install, such as the Android Support Library and Google Play Services.
  7. Click on the “Install” button to start the installation process.
  8. Once the installation is complete, you can close the SDK Manager and proceed to the next step.

By installing the Android SDK, you now have access to all the necessary tools and resources for developing Android applications. In the next section, we will guide you through the process of setting up the RFID reader.


Setting Up the RFID Reader

Now that you have installed the Android SDK, it’s time to set up your RFID reader and configure it to work with your Android device. Follow these steps to get started:

  1. Connect the RFID reader to your Android device using a USB OTG cable.
  2. If your RFID reader requires external power, make sure to connect it to a power source.
  3. Ensure that the RFID reader is properly recognized by your Android device. You can check this by going to the “Settings” of your Android device, selecting “Connected Devices” or “USB Devices,” and verifying that the RFID reader is listed.
  4. If your RFID reader comes with a manual or documentation, consult it to find any specific instructions for setting up the reader on Android.
  5. Some RFID readers may require additional configuration or settings changes to work with Android. Check the manufacturer’s website or support resources for any specific instructions on configuring the reader for Android compatibility.

Once you have set up the RFID reader and ensured its compatibility with your Android device, you are ready to move on to the next steps, which involve configuring permissions and creating a new Android project. These steps will be covered in the upcoming sections.


Configuring Permissions

In order to read RFID tags with your Android device, you need to configure the necessary permissions in your Android project. These permissions allow your app to access the device’s NFC functionality and communicate with the RFID reader. Here’s how you can configure the permissions:

  1. Open your Android project in your preferred Integrated Development Environment (IDE), such as Android Studio.
  2. Navigate to the AndroidManifest.xml file.
  3. Add the following permissions inside the <manifest> tag:
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  1. In some cases, you may also need to add additional permissions specific to the RFID reader you are using. Refer to the manufacturer’s documentation for any additional permissions required.

By configuring these permissions, your Android app will have the necessary access rights to utilize the device’s NFC capabilities and communicate with the RFID reader. In the next section, we will cover the process of creating a new Android project.


Creating a New Android Project

To begin developing your RFID reader app, you need to create a new Android project in your chosen Integrated Development Environment (IDE). Follow these steps to get started:

  1. Open your preferred IDE, such as Android Studio.
  2. Click on “Create New Project” to start a new Android project.
  3. Provide a name for your project and choose the desired package name.
  4. Select the minimum SDK version that is compatible with your target audience.
  5. Choose an Empty Activity template or any other template based on your app’s requirements.
  6. Click on “Finish” to create the project.

By creating a new Android project, you have the foundation to start building your RFID reader app. In the next section, we will guide you through adding the required dependencies to your project.


Adding Required Dependencies

In order to read RFID tags with your Android app, you need to add the necessary dependencies to your project. These dependencies provide the required libraries and tools for interacting with NFC and the RFID reader. Follow these steps to add the dependencies:

  1. Open your Android project in your IDE.
  2. Navigate to the build.gradle file (usually located in the app module directory).
  3. Inside the dependencies block, add the following dependencies:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-nfc:17.0.0'
  1. Sync your project to ensure that the dependencies are properly added.

By adding these dependencies, you have access to the necessary tools and libraries for working with NFC and the RFID reader in your Android app. In the next section, we will discuss designing the user interface of your RFID reader app.


Designing the User Interface

The user interface of your RFID reader app plays a crucial role in providing a seamless and intuitive experience for users. Here are some tips for designing an effective and visually appealing user interface:

  1. Keep it Simple: Avoid cluttering the interface with unnecessary elements. Focus on the core functionality of reading RFID tags and make sure it is easily accessible to the users.
  2. Use Intuitive Controls: Use buttons, input fields, and other interactive elements that users are familiar with. This will help users navigate and interact with your app effortlessly.
  3. Consider Readability: Use clear and legible fonts, appropriate font sizes, and contrasting colors to ensure that the text and content on the screen are easily readable.
  4. Responsive Layout: Design your user interface to adapt to different screen sizes and orientations. This will ensure that your app looks great on various Android devices.
  5. Provide Visual Feedback: Use visual cues, such as animations or progress indicators, to provide feedback to users when RFID tags are being read or when actions are being performed.
  6. Follow Material Design Guidelines: Consider following Google’s Material Design guidelines to create a modern and consistent look and feel for your app.

Remember, the user interface should not only be visually appealing but also functional and intuitive. Keep the end-user in mind when designing the interface and strive to create a seamless experience for them.


In the next section, we will move on to the coding part and discuss how to write the necessary code to read RFID tags with your Android app.


Writing the Code to Read RFID Tags

Now that you have set up the necessary hardware and designed the user interface, it’s time to dive into the code. Follow these steps to write the code that will enable your Android app to read RFID tags:

  1. Create a new Java class or open the existing activity class where you want to handle the RFID tag reading functionality.
  2. Import the necessary classes and packages for NFC and RFID tag reading. This typically includes the NfcAdapter and Ndef classes.
  3. In the onCreate() method of your activity, initialize the NfcAdapter by calling the getDefaultAdapter() method. This will give you a reference to the device’s NFC adapter.
  4. Create a PendingIntent object using the PendingIntent.getActivity() method. This pending intent will be used to handle the NFC intent when a tag is detected.
  5. In the onResume() method of your activity, enable the foreground dispatch for NFC events using the enableForegroundDispatch() method of the NfcAdapter. Pass in the activity, the PendingIntent, and the array of IntentFilters that specify the NFC events you want to handle (e.g., ACTION_TECH_DISCOVERED).
  6. Override the onNewIntent() method in your activity to handle the NFC intent when a tag is detected. Extract the RFID tag data from the intent and process it as needed.
  7. In the onPause() method of your activity, disable the foreground dispatch using the disableForegroundDispatch() method of the NfcAdapter.

This is a basic outline of the code needed to read RFID tags with your Android app. You will need to handle the specific logic based on the requirements of your app and the RFID reader you are using.


It’s important to test your code thoroughly and handle any exceptions or errors that may occur during the RFID tag reading process.


In the next section, we will discuss testing the RFID reader app to ensure that it functions properly.


Testing the RFID Reader App

Testing is a crucial step in the development process, especially when it comes to an RFID reader app. Here are some steps to help you test and ensure the functionality of your app:

  1. Verify Hardware Connection: Make sure your RFID reader is properly connected to your Android device through the USB OTG cable.
  2. Test with Dummy RFID Tags: Use dummy RFID tags that are known to work with your RFID reader. Place these tags near the reader and check if your app can read and display the tag data correctly.
  3. Verify Tag Detection: Test different types of RFID tags (if available) to ensure that your app can detect and read different frequencies and formats.
  4. Test Error Scenarios: intentionally place an unsupported tag or remove the tag quickly during the reading process to check if your app can handle such error scenarios gracefully without crashing.
  5. Perform Real-World Scenarios: Create different scenarios that mimic real-world situations where RFID tags might be used. Test the app’s performance and accuracy in reading tags in these scenarios.
  6. Check for App Responsiveness: Monitor the app’s responsiveness and ensure that it doesn’t freeze or crash during the RFID tag reading process.
  7. Gather Feedback: Share your app with colleagues or beta testers and gather feedback on its usability and effectiveness in reading RFID tags.

By thoroughly testing your RFID reader app, you can identify any issues or bugs and make necessary improvements to enhance its functionality and user experience.


Before concluding, let’s summarize what we have covered in this article.



In this article, we explored the process of reading RFID tags with an Android device. We discussed the required hardware, including the Android device, RFID reader, USB OTG cable, and RFID tags.


We then moved on to installing the Android SDK and configuring permissions to enable NFC communication and access to the RFID reader. We also covered the steps for creating a new Android project and adding the necessary dependencies.


Designing a user-friendly interface is crucial for a seamless RFID reader app. We provided some tips on keeping the interface simple, using intuitive controls, and following design guidelines like Material Design.


Next, we delved into the code required to read RFID tags, including initializing the NfcAdapter, handling NFC intents, and processing tag data. We emphasized the importance of thorough testing, including verifying the hardware connection, testing different tag scenarios, and checking for app responsiveness.


By following the steps outlined in this article and testing your RFID reader app, you can create a robust and efficient solution for reading RFID tags with your Android device.


Remember to stay updated with the latest Android SDK updates and firmware upgrades for your RFID reader to ensure compatibility and continued functionality.


Now you are equipped with the knowledge and tools to start developing your own RFID reader app. Happy coding!