B4A Library NFC library

Attachments

  • NFC.zip
    4 KB · Views: 1,878
Last edited:

bluedude

Well-Known Member
Licensed User
Longtime User
Nfc

How can I check if it has read an URL or a text? How do I know when to use GetAsTextType or GetAsUriType?
 

bluedude

Well-Known Member
Licensed User
Longtime User
The provided sample code works but not sure how to determine which type it has detected.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Nfc

Hi Erel, it all works like expected :)

I have one question, are you planning to do the writing functionality?

I ask this because the other solutions need me to use my Android to type all these URL's etc. and that sucks. I have a central database of tags that I want to load on my Android so that I can "click and write". So a store manager can walk around with his Android and re-write certain tags all from a central database.

Cheers,
 

manios

Active Member
Licensed User
Longtime User
Compiler Error

Hi Erel,

I am getting the following error:
B4X:
Compiling code.                         0.11
Generating R file.                      0.00
Compiling generated Java code.          Error
B4A line: 28
r = records.Get(i)
javac 1.6.0_25
src\de\mrsoft\xnfc\main.java:238: package android.nfc does not exist
_r.setObject((android.nfc.NdefRecord)(_records.Get(_i)));
                         ^
1 error
Could you give me a hint where to look?

Thanks
 

bluedude

Well-Known Member
Licensed User
Longtime User
NFC writing

Alright, clear.

Will find another solution for writing, there are some desktop tools to do that.
 

manios

Active Member
Licensed User
Longtime User
Yes, you should choose Tools - Configure Paths and reference android.jar from platform level 10 or above.

Thanks, it was pointing to a lower level!
 

bluedude

Well-Known Member
Licensed User
Longtime User
After in depth testing, compatibility issue NFC and TTS/Voice recognition

Erel,

Now that I start using all libraries together I face compatibility issues between libraries etc. and that is a lot of work to figure out.

One problem I discovered is between NFC and TTS/Voice recognition.

I have a search engine that can be controlled by smart objects (QR, NFC) and voice recognition.

When first using NFC and after that voice recognition it always returns true on this line for NFC:

If NFC.IsNdefIntent(Activity.GetStartingIntent) Then

Wondering how I can cope with that? Both options activate an Activity resume and because NFC is always true it always overwrites the returned values of the voice recognition. So first it detects my voice phrase but then because GetStartingIntent is true again it overwrites the search phrase with the NFC data.

I'm also checking Activity.GetStartingIntent.ExtrasToString but it always contains NFC data after the voice recognition has closed.

Weird problem but maybe you know how to solve it.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is better to start a new thread for this question.

It is not a compatibility issue. If I understand correctly the problem, what happens is that GetStartingIntent returns the same intent as before. This is the expected behavior as no new intent was sent.

Try saving this intent in a process global variable. You will then be able to compare the current intent with the previous one and ignore it if it is the same intent.
 

mitsusdev

Member
Licensed User
Longtime User
Sources

Hi Erel,
please can you post source code of NFC library? I want add writeTAG methods.

Thx and Best Regards
 

roarnold

Active Member
Licensed User
Longtime User
Nfc

Alright, clear.

Will find another solution for writing, there are some desktop tools to do that.

Mr. Blue
I am starting to write an NFC application with my partner building the backend. Ordering tags, etc. The error the gent mentioned in the thread is from no record receipt as I'm sure you are aware.

R
 

KY Leng

Member
Licensed User
Longtime User
Config NFC Tag

The library code is not really relevant to writing feature. It just takes the NDEF message from the intent.

Dear Erel,

Please forgive me if what I post is an old question.
I would like to know how to config our smart phone to be a NFC Tag?
so that I can use my phone as NFC Tag to identify my self...
I do not want to use NFC Tag sticker since our phone already have NFC build-in
Tag.

Thank you in advance.
 
Top