How to: Android 7.0 read NFC tags when screen is off

If you want to install this mod, on your phone, your phone needs to be rooted, and run Android Nougat (7.0 or 7.1.1).

I’ve only tested this on a Oneplus 3 running Oxygen OS.

This guide assumes you have adb successfully installed, if you don’t have that, please go install adb first.

First connect your phone to your pc, using a usb cable, enable USB-debugging in developer settings.

Now open a terminal, and type the following commands

adb shell
su

There might be a popup on your phone screen, asking you if you want to allow root acces to ADB shell, click allow.

Now you have root access in your adb shell. Next step to do, is to remount /system as writable, create a backup, download the modified NfcNci.apk, and install it. Run the following commands to do that,

busybox mount -o remount,rw system
cd /system/app/NfcNci/
mv NfcNci.apk NfcNci_bak.apk
curl https://lasse-it.dk/files/NfcNci.apk > NfcNci.apk
chmod 755 /system/app/NfcNci/NfcNci.apk
killall com.android.nfc

Now make sure NFC is turned on, try to read a NFC tag with the screen on, then try with the screen turned off.

If NFC now doesn’t work at all, try rebooting your phone. If that doesn’t fix it, run the following commands, to revert this mod.

adb shell
su
busybox mount -o remount,rw system
cd /system/app/NfcNci/
rm NfcNci.apk
mv NfcNci_bak.apk NfcNci.apk

Now NFC should function again, when the phone is unlocked.

Lasse Hyldahl Jensen on EmailLasse Hyldahl Jensen on GithubLasse Hyldahl Jensen on GoogleLasse Hyldahl Jensen on InstagramLasse Hyldahl Jensen on LinkedinLasse Hyldahl Jensen on Twitter
Lasse Hyldahl Jensen

14 thoughts on “How to: Android 7.0 read NFC tags when screen is off

  1. does this also work for android 7.1.1 or is there any minor difference to 7.0?

    Reply

  2. Is there a way to do this on Windows?
    I’ve tried it and everything worked until the “curl” command.

    Reply

  3. You need to have adb installed, and remember to run the commands on the device, not windows. This is done by typing “adb shell” followed by “su” to gain admin access on your android device

    Reply

  4. Awesome πŸ™‚ Thanks For sharing.
    BTW, I still use Marshmallow ROM’s mainly because the Xposed Framework is not yet available with Nougat. Is there a chance to have a mod that works with MM? <3 The "NcfScreenOffEnabler" XposedModule work only with KK and LP πŸ™

    Reply

  5. Thank you. Indeed I looked at your guide (very nice btw), but the NfcService and ScreenStateHelper files are a bit different. I have some knowledge but not enough.

    For example, the “checkScreenState ()” method is defined as:

    “return !this.mPowerManager.isScreenOn() ? SCREEN_STATE_OFF : this.mKeyguardManager.isKeyguardLocked() ? SCREEN_STATE_ON_LOCKED : SCREEN_STATE_ON_UNLOCKED;”

    There is no β€œconst/4 v0, 0x…” should I just return “SCREEN_STATE_ON_UNLOCKED” ?

    If you are interested, see the 2 files (Marshmallow)

    https://drive.google.com/open?id=0B0eBDY29hoSRUFBVRTQxWkVFUVU

    Sorry to bother you with all these questions, it does not matter if I do not have any answers πŸ˜‰

    Reply

    1. Nevermind, with smali I got things similar than your guide πŸ˜‰ Will give a try.

      Reply

  6. After quite a few hours I finally succeeded. πŸ™‚

    I first had problems to decompile and recompile apk.
    Indeed the service NFC often stopped, I had compilation errors etc ..

    And then my NfcService.smali file is quite different from your, so I modified only one thing: the 4 lines:

    Android.intent.action.SCREEN _ *** A

    And it works for now.

    Thanks again, I will not have succeeded without your guide πŸ™‚

    Reply

  7. Hi, thanks for your tuto, sadly it doesn’t work for me (S7 edge on Android 7.0 stock).
    I think I will downgrade ti marschmallow until xposed available on nougat…

    Reply

  8. Hey, im using Lineage OS 14.1 and i dont have a NfcNci folder in /system/app theres just a NQNfcNci Folder with an NQNfcNci.apk in it but replacing and renaming this one doesnt work. Any ideas?

    Reply

  9. Please help me, I messed up NFC by trying this with Android 8, renamed the NfcNci_bak.apk back to NfcNci.apk, NFC still crashes after reboot. Help is incredibly highly appreciated!

    Reply

Leave a Reply