Search code examples
androidnfcazure-api-apps

Can Android NFC work without user input/action or without notification?


Currently, I am researching the feasibility of an attendance application with the below features written for Android and iOS. iOS - can't be automated. It needs a user input or clicking every time a tag is tapped.

However, I don't have many google results about Android NFC functions. I want the following functions in my attendance app.

  • Write employee id into a tag or record the tag identifier in an employee record (with 3rd party app)

  • The attendance app will be installed and set up on an Android mobile phone and it will be kept in a plastic case (attendance kiosk). https://www.famoco.com/use-case/infordata-nfc-students-attendance-tracking/

  • employees tap and go

  • Send a tag id or employee id to an Azure API (a token with Azure Daemon API)

  • API checks if the tag is belonging to an employee

  • API gets the current status of attendance

  • API sends back to the android app with status - success, no employee record found, already tapped and cancelled with four times attempts within a certain time period. eg 30 seconds.

  • Display the result in the app

I'd like to automate the above steps and no user (employee) action/input/clicking must be required in the attendance mobile device app (attendance kiosk).

Is it doable in Android mobile and NFC app?


Solution

  • So you have said the screen will be locked but this mean that NFC will be disabled for normal apps and you have limited capability of displaying stuff to users.

    But that is not really what you want to do, you actually want to have the device unlocked BUT in a kiosk type mode. There are third party solutions to do this but you can make your own App do this using various features like "Lock Task Mode", "Be Home App", etc from the Dedicated devices API's

    Once you have made your App the only App that can run in the foreground and the device will never go to sleep or lock itself using Dedicated devices features THEN your App can read and process NFC cards without user Interaction as per a normal foreground NFC APP (I would recommend using EnableReaderMode NFC API to do this as it does not have to pause and restart the foreground App to read the card)

    Other Points

    • The devices needs to be mains powered otherwise it will go flat quickly
    • Don't use an OLED screen otherwise you will have screen burn problems
    • Don't use the Tag ID because this can be faked and is not secure, use cryptographic methods to securely write data to the Tag
    • Using a phone is not so good for the user interaction as the NFC reader is usually on the back and usually they won't read through the screen so the user needs access to the back of the phone to place the Tag to be read

    So overall doable with some work and all the user would have to do is Tap the NFC Tag to the back of the phone.