Home » Android » android – Enable/Disable NFC with ADB command

android – Enable/Disable NFC with ADB command

Posted by: admin June 15, 2020 Leave a comment

Questions:

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

I found one answer here.

What I tried from the above link:

# Enable NFC
service call nfc 5

# Disable NFC
service call nfc 4 

but it’s not working.

Any help appreciated. Thanks.

How to&Answers:

# Disable NFC

service call nfc 7

Verified for Android 8.0

Cheers!

Answer:

In your DDMS of eclipse or using logfilter or any runtime log capturing tool, you need to get the process ID of your NFCService. Then you can kill or stop that process by giving the process ID.

Answer:

I don’t know why no one has posted this already

svc nfc <enable|disable>

Works perfectly

Edit: Requires > Android 6.0

Answer:

System services’ method codes may vary with Android versions. Therefore, before making a service’s method call browse the AOSP sources.

Below is a summary of the NFC‘s enable/disable calls up to Android 5.1.1. Also keep in mind that (in the sources)

int FIRST_CALL_TRANSACTION  = 0x00000001

,i.e. equals 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

Answer:

Please try this

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

please check here in slide no 32

Answer:

For Android Version > 7, please use following –

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

Verified on 7.1.1… Should work for atleast 7.x