underwindfall / NFCAndroid

This is a project to using android HCE by using Type-4-Tag Message to working both in iOS and Android
MIT License
294 stars 58 forks source link

Weird intent action #11

Open markusbug opened 1 year ago

markusbug commented 1 year ago

Hey!

When I have a device running the HCE and another one running "readnfcmessage", the reader is always pushing as the intent action "android.intent.action.MAIN" and nothing in there. Why is the intent action this (even though the app is already open) and the phone is vibrating because an NFC chip was found?

Thanks in advance!

leonardosetiadi commented 10 months ago

Same to me, any solution for this? @markusbug did you find any other approach?

kevin930321 commented 4 months ago

@markusbug @leonardosetiadi I tried to build the the app but it keeps failing, Can you guys provide the apk file pls (in .zip), tks.

galihif commented 3 months ago

@markusbug it happens to me too

albertoZurini commented 2 months ago

Same issue here even when I approach a NDEF-formatted NFC tag (which for instance I can read from NFC tools on the same device). I tried changing the manifest accordingly to what they say here, but with no success. Was any of you able to get it working? I also tried updating the nfc_tech_filter like this, but I'm still getting the same wrong intent...

<resources >
    <tech-list>
        <tech>android.nfc.tech.IsoDep</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.NfcA</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.NfcB</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.NfcF</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.NfcV</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.Ndef</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.NdefFormatable</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.MifareClassic</tech>
    </tech-list>
    <tech-list>
        <tech>android.nfc.tech.MifareUltralight</tech>
    </tech-list>
</resources>
albertoZurini commented 2 months ago

I found this repository https://github.com/nguyencongtu2004/NFC-Demo that has a code able to read tags. I put the code from this repo there and I'm now able to read tags. Currently working on getting the HCE part of the code working. If anyone with more Android development experience can please tell me what's the difference between the two projects (I'm ignorant and I just checked the AndroidManifest and Gradle; they look more or less the same), it would be really cool!

albertoZurini commented 2 months ago

@underwindfall, I have a question: I didn't understand how the reader is able to trigger the HCE app. I can see here https://github.com/underwindfall/NFCAndroid/blob/0b15d14e50cc7d339f623dd990aa358010eefab8/app/src/main/res/xml/apduservice.xml#L7 the AID is set, but I only saw it also being put here for the check https://github.com/underwindfall/NFCAndroid/blob/0b15d14e50cc7d339f623dd990aa358010eefab8/app/src/main/java/com/qifan/nfcbank/cardEmulation/KHostApduService.kt#L22-L36. Why is it just on app and not on the readnfcmessage?

I also read your comment on StackOverflow: https://stackoverflow.com/questions/29122848/ndef-message-with-hce-android, but i quite haven't understood. Were you able to emulate the first authentication code message to be processed by the HCE app, so that the reader should just send the binary read message or am I getting something wrong here? PS: If that's true, I haven't understood how you were able to skip the first authentication message to be processed by the HCE app.

albertoZurini commented 2 months ago

I was able to get it working! Forked repo can be found here: https://github.com/albertoZurini/NFC-Demo, please send me pull requests if you found anything wrong!