2019-02-28 09:44 AM
Hi, I´m doing a project in which I have to programm an android app which shall write and read the mailbox. Using the ST25DV Demo app I figured out, how to read and write the Mailbox. A nice feature of the app should be, that I can read the tag and choos between various apps which can handle the technology.
What I want is: I read the Tag, then there is a android dialoge which shows my app that I can choose to open.
My Android-Manifest contains following code:
<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.TECH_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
In the "nfc_tech_filter" I added the techlists like in the ST25DV demo app:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- capture all ISO14443A tags (NFC tags Type 4)-->
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.IsoDep</tech>
<tech>android.nfc.tech.Ndef</tech>
</tech-list>
<!-- capture all ISO15693 tags -->
<tech-list>
<tech>android.nfc.tech.NfcV</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcV</tech>
<tech>android.nfc.tech.Ndef</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcV</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
<!-- capture all ISO14443B tags tags -->
<tech-list>
<tech>android.nfc.tech.NfcB</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
</resources>
If I scan my debit card, I can choose between various apps that I can start, including my own app. If I scan the St25DV, there is just the Dialog to choose between Google Play Store and Huawei App Galery.
I hope you understand my problem and have an advice or a solution.
Thank you very much for your time.
Michel
Solved! Go to Solution.
2019-03-12 07:11 AM
There might be a confusion between 2 different things:
You can have the following devices:
An Android Phone (with NFC capability) <==> A ST25DV Tag <==> A Microcontroler (ex: a STM32)
The ST25DV and the Microcontroler are connected through I2C.
This is for such use case that the ST25DV mailbox is useful. It allows to increase the data rate when the Android Phone and the Microcontroler communicate.
The mailbox is a small RAM of 256 bytes present in the ST25DV Tag.
When the Android Phone sends some data to the Microcontroler, the data exchanged are written to this RAM. The Microcontroler will be notified that there is some new data in the Mailbox and it will read them through I2C.
Same thing when the microcontroler sends data to the Android Phone.
The Mailbox speeds up the communication because it has a faster access time that EEPROM (a Tag is a EEPROM memory with an NFC interface).
You have the following devices:
An Android Phone (with NFC capability) <==> A ST25DV Tag
In this case, the Android phone may want to store some data in the NFC Tag (that means in EEPROM memory). A very usual way is to use NDEF Formatted data. Some NFC commands are used to write the NDEF data into ST25DV's EEPROM.
In that case, the Mailbox is NOT used because it would not bring any benefit.
Regards
Olivier
2019-03-01 04:10 AM
Hi Michel,
What is the memory size of your ST25DV? Is it a ST25DV04K, ST25DV16K or ST25DV64K?
Regards
Olivier
2019-03-01 04:40 AM
Hi Oliver,
it is the ST25DV04K. I recognized that I can write the Tag with the demo app, so it will send an NDEF-Message which searches my app-package. But is it possible to start the app with an Intent? By reading the Tag with an other app, I saw that the techs that are discovered are:
android.nfc.tech.NfcV
android.nfc.tech.Ndef
If I add this to my techlist it still won't work.
Regards
Michel
2019-03-01 05:03 AM
Hi Michel,
"I recognized that I can write the Tag with the demo app, so it will send an NDEF-Message which searches my app-package."
What kind of NDEF Message did you use? Did you set an AAR Record (aka Android App Launcher record) indicating to launch your program?
I need more information about what you want to do.
For example, here are some possibilities:
I think that you are trying the second use case but I'm not sure.
Regards
Olivier
2019-03-01 05:17 AM
Hi Olivier,
I used the AAR Record to launch my program, yes.
I want to start my android application everytime a ST25DV04K is tapped.
The image below shows the thing I want. With my smartphone i come closer to the ST25DV04K and if it is recognized by my smartphone I want to be asked which app I want to use. My App here is called "Studienarbeit". The code above works with my own debit card and some others but not with the ST25DV04K.
Thank you for your efforts. I hope you got what I mean. I'm quite new to NFC and programming android application. Please excuse this.
Regards
Michel
2019-03-01 05:43 AM
No problem Michel, that’s the role of this forum to answer to questions.
You have problems to launch your own Android App through NFC Intents. This is maybe due to your NFC Intent Filters that could be wrong. To know if that's the case, I propose you an intermediate test:
I can see on your image that you have our ST25 NFC Tap application installed. Please launch it and program your tag with an AAR record indicating to launch our application. Leave the application and check if it gets opened when you tap the ST25DV tag. On my side it is working.
BTW, if it works, you will see that the ST25 NFC Tap application will be opened but you will have to tap the tag again to get some information about it displayed. To change this behavior, you can add a URI record (the URI doesn't matter. I have used www.st.com) and then add a AAR record (it should be in second position).
Do the test and this time, the ST25 NFC Tap should be opened and display informations about the tag.
Regards
Olivier
2019-03-12 02:24 AM
Hi Olivier,
the test with the AAR was successful, thank you very much for this advice. I think the Intent Filters are just wrong. The Tag will be used for just one application, so I will use the AAR to start the app from now on.
Now I wonder, how the datatransfer works. I know how the protocol in the ST App is defined, but is it the also the protocol for the physical layer or is it the payload of an NDEF-Message?
Regards
Michel
2019-03-12 06:22 AM
Hi Michel,
That's good to hear that you succeeded to launch your application through an AAR.
For which data transfer do you want more information? Is it about the protocol used to exchanged data through the ST25DV's mailbox?
Regards
Olivier
2019-03-12 06:51 AM
Hi Olivier,
I want to transfer Data which can vary in size from my Smartphone to the ST25DV using the Tag's mailbox. I used the code from ST25DVTransferTask Class and it is working, but I did not understand yet which type of Message it is. For me the protocol defined in this class looks almost like a normal NDEF-Message, just a few properties seem to be different?
Regards
Michel
2019-03-12 07:11 AM
There might be a confusion between 2 different things:
You can have the following devices:
An Android Phone (with NFC capability) <==> A ST25DV Tag <==> A Microcontroler (ex: a STM32)
The ST25DV and the Microcontroler are connected through I2C.
This is for such use case that the ST25DV mailbox is useful. It allows to increase the data rate when the Android Phone and the Microcontroler communicate.
The mailbox is a small RAM of 256 bytes present in the ST25DV Tag.
When the Android Phone sends some data to the Microcontroler, the data exchanged are written to this RAM. The Microcontroler will be notified that there is some new data in the Mailbox and it will read them through I2C.
Same thing when the microcontroler sends data to the Android Phone.
The Mailbox speeds up the communication because it has a faster access time that EEPROM (a Tag is a EEPROM memory with an NFC interface).
You have the following devices:
An Android Phone (with NFC capability) <==> A ST25DV Tag
In this case, the Android phone may want to store some data in the NFC Tag (that means in EEPROM memory). A very usual way is to use NDEF Formatted data. Some NFC commands are used to write the NDEF data into ST25DV's EEPROM.
In that case, the Mailbox is NOT used because it would not bring any benefit.
Regards
Olivier