Alpha Video Training
Results 1 to 8 of 8

Thread: NFC in AA Mobile

  1. #1
    Member
    Real Name
    John Titor
    Join Date
    May 2015
    Posts
    109

    Default NFC in AA Mobile

    Hey guys,

    Has anyone been able to implement NFC reader to fill a text control?

    I found this https://github.com/chariotsolutions/phonegap-nfc plugin but not sure how to use it in alpha of how to reference it. I dont see any NFC or RFID in the actions in AA.

    Can someone please guide me in this. I've searched here for some information but didnt really find much.

    Thank You

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,728

    Default Re: NFC in AA Mobile

    I used this a couple of years ago for a project and it worked out quite well. The plugin looks current... an update 3 months ago... so follow their doc.

    I only built for Android as iOS had not exposed their NFC chip at that point. I believe it's available now.

    As far as I know there are no Alpha actions specific to NFC... but there really is no need. It's all Javascript and the plugin doc is good.

    In the onPhoneGapReady event...

    Code:
    nfc.addNdefListener(onNFC, successNFC, failureNFC);
    In Javascript functions...

    Code:
    function successNFC(result) {
        console.log("Listening for NFC Messages");
    }
    function failureNFC(reason) {
        alert("Failed to add NDEF listener");
    }
    
    function onNFC(nfcEvent) {
        // display the tag as JSON
        debugger;
        var tagInfo = nfcEvent.tag;
        //alert(JSON.stringify(nfcEvent.tag));
        var nfcValue = nfcEvent.tag.ndefMessage[0]["payload"];
        var nfcText = nfc.bytesToString(nfcValue);
        nfcText = nfcText.substring(3);
        {dialog.Object}.setValue('textNFC',nfcText);
    }
    I've not run this code in years... so I don't know what's changed in PGB or the plugin... but it might help get you there.
    Last edited by Davidk; 08-29-2018 at 11:13 AM.

  3. #3
    Member
    Real Name
    John Titor
    Join Date
    May 2015
    Posts
    109

    Default Re: NFC in AA Mobile

    It worked perfectly. Thanks so much !!!

  4. #4
    Member
    Real Name
    Roland Soutar
    Join Date
    May 2012
    Posts
    104

    Default Re: NFC in AA Mobile

    its still a quality piece of code after all these years David.
    Roland

  5. #5
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,728

    Default Re: NFC in AA Mobile

    Quote Originally Posted by Dspguards View Post
    its still a quality piece of code after all these years David.
    Roland
    Cheers!

  6. #6
    Member
    Real Name
    Ollie Halliday
    Join Date
    Feb 2013
    Posts
    104

    Default Re: NFC in AA Mobile

    Hi,

    I've been trying to get NFC tagging on iOS, has anyone managed to implement NFC on iOS?

    Looking at the documentation nfc.beginSession(success, failure) has to be used but I can not seem to get the tagging working?

    Thanks

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,728

    Default Re: NFC in AA Mobile

    I believe this cannot be done easily. From what I've read, XCode must be used. You can build your app in Alpha, but then you must involve CLI and XCode to complete it.

    Have a look here. Alpha has built support for this process. I've not done this yet, but will, and report back.

    https://documentation.alphasoftware....port/index.xml
    Last edited by Davidk; 04-18-2019 at 07:47 PM.

  8. #8
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,728

    Default Re: NFC in AA Mobile

    To confirm, you must use the excellent Alpha CLI Builder to create the files required for an XCode project. Then transfer those file over to the Mac... and following the instructions in the Alpha CLI Support doc.

    Once you're finally in XCode with your project loaded, you must click on your Project name and then you'll see a menu bar appear at the top of the middle section. There you'll see a selection "Capabilities". In Capabilities you must turn on "Near Field Communication Tag Reading". If this is already on, turn it off, then back on again... and that will fix this part.

    Next, in the Project Navigator... under Staging, under WWW, find your index.html file. Around line 89 in the index.html file you'll find...

    Code:
    <script src="phonegap.js"></script>
    You must change this to "cordova.js". This is a very old setting that Alpha needs to change... but there you go.

    Now you can build your project.

Similar Threads

  1. mobile login component not working on mobile emulators
    By amitloh in forum Mobile & Browser Applications
    Replies: 6
    Last Post: 05-28-2017, 12:23 PM
  2. Replies: 2
    Last Post: 05-08-2014, 07:04 PM
  3. Web OR Mobile?
    By Riverguy in forum Mobile & Browser Applications
    Replies: 6
    Last Post: 11-26-2013, 10:05 AM
  4. Mobile panel footer container overlap on mobile
    By Claire Shuttleworth in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 07-29-2013, 04:18 PM
  5. Replies: 0
    Last Post: 12-14-2010, 10:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •