Enable / Disable NFC Using ADB Command

Is there any way to disable / enable NFC through ADB shell commands?

I found one answer here .

What I tried at the link above:

 # Enable NFC service call nfc 5 # Disable NFC service call nfc 4 

but it does not work.

Any help appreciated. Thanks.

+7
android shell adb nfc
source share
6 answers

In your eclipse DDMS or using logfilter or any runtime log capture tool, you need to get the process id of your NFCService. You can then kill or stop this process by specifying the process ID.

+3
source share

# Disable NFC

nfc 7 service call

Confirmed for Android 8.0

Hooray!

+2
source share

System service method codes may vary by version of Android . Therefore, before calling the service method, look at the AOSP sources.

Below is a summary of NFC allow / block calls prior to Android 5.1.1. Also keep in mind that (in sources)

 int FIRST_CALL_TRANSACTION = 0x00000001 

i.e. equal to 1 .

Android 4.4 - Android 5.1.1

 # Disable NFC service call nfc 5 # Enable NFC service call nfc 6 

Android 4.0.1 - Android 4.3.1

 # Disable NFC service call nfc 4 # Enable NFC service call nfc 5 

Android 2.3.4 - Android 2.3.7

 # Disable NFC service call nfc 18 # Enable NFC service call nfc 19 

Android 2.3.3 :

 # Disable NFC service call nfc 20 # Enable NFC service call nfc 21 

Android 2.3.2 :

 # Disable NFC service call nfc 13 # Enable NFC service call nfc 14 

To check the status of the NFC service, use the dumpsys command:

 dumpsys nfc 
+1
source share

Please, try

 # Enable NFC service call nfc 6 # Disable NFC service call nfc 5 

please check here in slide no 32

0
source share

For Android version> 7, please use the following command

 # Enable NFC service call nfc 7 # Disable NFC service call nfc 6 

Tested on 7.1.1 ... At least 7.x should work

0
source share

I do not know why no one has published this already

svc nfc <enable|disable>

Works great

Edit: required> Android 6.0

-one
source share

All Articles