Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:46:09+00:00 2026-06-05T19:46:09+00:00

I am trying to write a simple application to interact with NFC tags, but

  • 0

I am trying to write a simple application to interact with NFC tags, but I cant seem to get my phone to do anything but trigger the default NFC tag app. I really just want to be able to intercept any tag I scan, determine if it has some data on it, and take action accordingly.

Right now my manifest file looks like

<uses-sdk android:minSdkVersion="10" />
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<uses-permission android:name="android.permission.NFC"/>

<application 
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".NfcActivity"
        android:label="@string/app_name">
        <intent-filter>
           <action android:name="android.intent.action.MAIN"/>
           <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
        </intent-filter>
    </activity>
</application>

However when scanning an NFC tag, I never see the activity start. Am I missing something here? I tried placing the intent filter inside a BroadcastReceiver and had no luck either…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:46:11+00:00Added an answer on June 5, 2026 at 7:46 pm

    You cannot have your app started by all NFC tags you scan. Android will determine what the most suitable app is based on how specific the intent filter is. However, if your app is running in the foreground, you can use NFC foreground dispatch to catch all NFC intents.

    In onCreate() add:

    mAdapter = NfcAdapter.getDefaultAdapter(this);
    PendingIntent pendingIntent = PendingIntent.getActivity(
      this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
    

    In onResume() add:

    mAdapter.enableForegroundDispatch(this, pendingIntent, null, null);
    

    In onPause() add:

    mAdapter.disableForegroundDispatch(this);
    

    In onNewIntent you can get at the NFC tag like this:

    Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a fairly simple threaded application, but am new to boost's
I'm trying to write a simple XMPP application on Android using asmack, but I've
I'm trying to write myself a simple Python application to get a contents of
I am trying to write a simple application that runs on a Windows Mobile
I'm trying to write a simple application where I have a keyboard listener in
I've been trying to write a simple Static-class State Machine for my application to
I am trying to write a simple application that gets updated. For this I
I'm trying to write a simple WPF application in C#. Coming from a primarily
I'm trying to write a simple gui application to manage ruby version manager. I
I am trying to write a simple matrixMultiplication application that multiplies two square matrices

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.