B4A Library NFC library

Discussion in 'Additional libraries, classes and official updates' started by Erel, Feb 12, 2012.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Attached Files:

    • NFC.zip
      File size:
      4 KB
      Views:
      1,095
    Last edited: Sep 10, 2013
    thesigfrid likes this.
  2. bluedude

    bluedude Well-Known Member Licensed 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?
     
  3. bluedude

    bluedude Well-Known Member Licensed User

    The provided sample code works but not sure how to determine which type it has detected.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Please do not post duplicate questions. See my answer in the other thread.
     
  5. bluedude

    bluedude Well-Known Member Licensed 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,
     
    fabio55 likes this.
  6. manios

    manios Active Member Licensed User

    Compiler Error

    Hi Erel,

    I am getting the following error:
    Code:
    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
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Yes, you should choose Tools - Configure Paths and reference android.jar from platform level 10 or above.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Not in the near future. It seems to be a very complicated functionality, especially as there are several issues in Android which require a workaround.
     
  9. bluedude

    bluedude Well-Known Member Licensed User

    NFC writing

    Alright, clear.

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

    manios Active Member Licensed User

    Thanks, it was pointing to a lower level!
     
  11. bluedude

    bluedude Well-Known Member Licensed 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.
     
  12. Erel

    Erel Administrator Staff Member Licensed 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.
     
  13. bluedude

    bluedude Well-Known Member Licensed User

    Hi Erel, i solved this problem and indeed it works now.
     
  14. jjcc

    jjcc Member Licensed User

    Can not find sample code you mentioned.
     
  15. Erel

    Erel Administrator Staff Member Licensed User

  16. jjcc

    jjcc Member Licensed User

    Thank you Erel. Have tried. Works great.
     
  17. mitsusdev

    mitsusdev Active Member Licensed User

    Sources

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

    Thx and Best Regards
     
  18. Erel

    Erel Administrator Staff Member Licensed User

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

    roarnold Active Member Licensed User

    Nfc

    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
     
  20. KY Leng

    KY Leng Member Licensed User

    Config NFC Tag

    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.
     
Loading...