Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird intent action #11

Open
markusbug opened this issue Sep 24, 2023 · 10 comments
Open

Weird intent action #11

markusbug opened this issue Sep 24, 2023 · 10 comments

Comments

@markusbug
Copy link

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
Copy link

leonardosetiadi commented Jan 22, 2024

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

@kevin930321
Copy link

@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
Copy link

galihif commented Aug 28, 2024

@markusbug it happens to me too

@albertoZurini
Copy link

albertoZurini commented Sep 26, 2024

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
Copy link

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
Copy link

@underwindfall, I have a question: I didn't understand how the reader is able to trigger the HCE app. I can see here

<aid-filter android:name="D2760000850101"/>
the AID is set, but I only saw it also being put here for the check
private val APDU_SELECT = byteArrayOf(
0x00.toByte(), // CLA - Class - Class of instruction
0xA4.toByte(), // INS - Instruction - Instruction code
0x04.toByte(), // P1 - Parameter 1 - Instruction parameter 1
0x00.toByte(), // P2 - Parameter 2 - Instruction parameter 2
0x07.toByte(), // Lc field - Number of bytes present in the data field of the command
0xD2.toByte(),
0x76.toByte(),
0x00.toByte(),
0x00.toByte(),
0x85.toByte(),
0x01.toByte(),
0x01.toByte(), // NDEF Tag Application name
0x00.toByte(), // Le field - Maximum number of bytes expected in the data field of the response to the command
)
. 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
Copy link

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!

@kevin930321
Copy link

@albertoZurini Could you provide the APK file? Thanks.

@albertoZurini
Copy link

albertoZurini commented Dec 27, 2024

@albertoZurini Could you provide the APK file? Thanks.

@kevin930321 what do you mean by APK? If you go to my repo you can check the GIF. There's not much point in sharing the APK since it is useless (only transferring a string from a phone to the other). If you want it I can share it still, would you like to share an email/Telegram/whatever I can send the APK to?

@kevin930321
Copy link

@albertoZurini Oh, I see, never mind then, thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants