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 7692689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:54:37+00:00 2026-05-31T20:54:37+00:00

How would you open your application directly using an intent filter when using the

  • 0

How would you open your application directly using an intent filter when using the NFC service with a Mifare card? I know that you can use an intent filter using a specific mimeType directly for a P2P Connection like

<data android:mimeType="application/com.sticknotes.android"/>

I’m just not sure how I’d set up the sectors of a Mifare1K to do the same thing. Anybody have any ideas on how to do this? Or am I just limited to having the application chooser pop-up?

I suppose I could create a completely separate activity to handle passive tags versus active devices but is there any way to handle this all in one activity??

  • 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-05-31T20:54:39+00:00Added an answer on May 31, 2026 at 8:54 pm

    If your app already has an intent filter for the MIME type “application/com.sticknotes.android” that works with Android Beam (P2P connection), then it will also work with tags that contain and NDEF message with the same MIME type. Android Beam and tag discovery both generate an ACTION_NDEF_DISCOVERED intent in the receiving/reading device.

    To write such an NDEF message to a MIFARE Classic 1K tag, you can create a simple app that does that for you. In this app’s manifest file put:

    <activity>
    ...
    <intent-filter>
      <action android:name="android.nfc.action.TECH_DISCOVERED"/>
    </intent-filter>
    
    <meta-data android:name="android.nfc.action.TECH_DISCOVERED"
      android:resource="@xml/nfc_tech_filter" />
    ...
    </activity>
    

    And in project’s res/xml folder put a file nfc_tech_filter.xml with the following contents:

    <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
      <tech-list>
        <tech>android.nfc.tech.MifareClassic</tech>
      </tech-list>
    </resources>
    

    In the app’s Activity put:

    onCreate(Bundle savedInstanceState) {
      // put code here to set up your app
      ...
    
      // create NDEF message
      String mime = "application/com.sticknotes.android";
      byte[] payload = ... ; // put your payload here
      NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mime.toBytes(), null, payload);
      NdefMessage ndef = new NdefMessage(new NdefRecord[] {ndef});
    
      // write NDEF message
      Intent intent = getIntent();
      if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction()) {
        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
        NdefFormatable nf = NdefFormatable.get(tag);
        if (nf != null) {
          // tag not yet formatted with NDEF
          try {
            nf.connect();
            nf.format(ndef);
            nf.close();
          } catch (IOException e) {
            // tag communication error occurred
          }
        } else {
          Ndef n = Ndef.get(tag);
          if (n != null && n.isWritable() ) {
            // can write NDEF
            try {
              n.connect();
              n.writeNdefMessage(ndef);
              n.close();
            } catch (IOException e) {
              // tag communication error occurred
            }
          }
        }
      }
    }
    

    This formats and writes an NDEF message to unformatted (blank) MIFARE Classic tags or overwrites tags that are already formatted with NDEF. If you want to write other tag types besides MIFARE Classic ones, adjust nfc_tech_filter.xml accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know Installers can setup File Associations for your Application during the installation process,
How would you open a file (that has a known file/app association in the
I would like to open an OleDbConnection to an Excel file that's in memory
I would like to open a popup window using javascript in my c#.net app.
Possible Duplicate: How to open-source an application that uses API keys I have an
I have a windows form application that will open other forms, but will only
I was wondering, how would you go about writing an application that basically houses
BACKGROUND I am using a commercial application on windows that creates a drawing This
I have found an open source application that creates a JFrame to display some
What I'm trying to do is to write a script which would open an

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.