Closed hawkmauk closed 4 years ago
Hi Hawkmauk, That is something I definetly want to have in Zap. I have no experience with NFC so far, but I will have a look at your implementation in the next days :) Thank you very much!
There are a few details that still need to be worked on which is some of the additional help that would be needed .. ontop of this being my first foray into android development.
Sorry, I was very busy the last two weeks with my job, so I didn't find the time to explore this. But I should be able to do this till the end of the year.
Same here but hope to do some more over the next week when I have some time off
Hey, I just had a qick look at it and wanted to test it, but I do not know how to do so. If I use a second phone, both have NFC activated, then just the android Beam stuff starts. What do I need to test this? Furthermore I saw in my NFC settings that there is a "Tap and Pay" section where one can set the default Payment provider. Maybe we somehow have to get on that List with Zap.
The setup I had was with a Raspberry Pi but two android phones would be simpler to setup... unfortunately I only have one NFC enabled android phone. There is an app called NFC Tools that is useful and should be able to provide the functionality to test:
WRITE
tabAdd a record
Text
OK
More options
menu.Emulate an NFC tag (beta)
Thanks for the info. I tried, but the emulation doesn't seem to work. I am not able to read the emulated NFC Tag even if I try to read it using the NFC Tools app on the other phone. I also switched phones and emulated on the other and even with another NFC Tag emulation app. But no luck so far.
I am buying some tags now and see if that works ;-)
Hi, I received my tags and with them it worked! So I did some tests and further reading.
The intent in the manifest should not be of type text in my opinion. Instead it should be:
<data android:scheme="bitcoin" />
<data android:scheme="lightning" />
And I think we should support both, normal lightning and LNURL request via nfc. But LNURL is completely independent from nfc. Nfc just transmits the data. When LNURL support is added, it should make no difference if the data comes from scanning a QR-Code or from reading a nfc tag. So all we need to do regarding nfc is read the data and then start the intent that handles transaction data.
In your current implementation the tag information gets "lost" if the app is either not open at all or on another activity than the home activity. In that case the app just opens / goes to the home screen and then the tag has to be scanned again. This is of course not ideal and will have to be changed.
Furthermore, I think in the current state we do not need this permission: android.permission.NFC_TRANSACTION_EVENT in my tests it worked without it.
Great that you got it working! Did you use NFC Tools to emulate the tag? I was thinking that it might be easier to test if I tried to implement sending via NFC too but it might end up being implementation specific. Agree that both lightning and LNURL should be supported, although I'll need to do some reading up on LNURL but as you mention that shouldn't matter the transport of data which is in principal the same workflow as scanning a QR code. I realize that my current implementation is naive and need to do some more research on how Activities and Intents are used in Android.
The emulation did not work, so I bought some writeable tags. I have nearly finished the tag reading by now. I'll probably push a branch on my repo this Weekend, then you can have a look at it. I haven't included sending via NFC so far, but maybe we can try that next.
@hawkmauk I have a working solution now. Tags are readable directly from the home activity and the send activity. From other activities it behaves nearly similar to an app restart, which means it goes back to the home screen. When reading a tag while the app is closed, it now keeps the information and processes it as soon as the wallet is opened/unlocked. Furthermore I have moved most NFC logic into a separate util. You can check it out here: https://github.com/michaelWuensch/zap-android/tree/feature/Nfc If you find any problems, please let me know.
With services like Apple pay and Google pay NFC is going mainstream as a way to make payments with mobile devices, it would offer a familiar UX to new lightning users if payments via NFC were supported in mobile lightning wallets. I developed a PoC for this using a modified version of zap-android and would like some feedback and (hopefully) help and support in bringing this into the project which I believe would give it a good USP. Check out the [Https://GitHub.com/runcrypto/static-discharge](project repo) and [Https://GitHub.com/runcrypto/zap-android](modified zap repo) to see what I've managed to do so far.