Enable/Disable NFC with ADB command

后端 未结 6 1996
無奈伤痛
無奈伤痛 2020-12-20 16:15

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

I found one answer here.

What I tried from the above link:



        
相关标签:
6条回答
  • 2020-12-20 16:40

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

    svc nfc <enable|disable>

    Works perfectly

    Edit: Requires > Android 6.0

    0 讨论(0)
  • 2020-12-20 16:42

    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.

    0 讨论(0)
  • 2020-12-20 16:57

    # Disable NFC

    service call nfc 7

    Verified for Android 8.0

    Cheers!

    0 讨论(0)
  • 2020-12-20 17:03

    Please try this

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

    please check here in slide no 32

    0 讨论(0)
  • 2020-12-20 17:04

    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
    
    0 讨论(0)
  • 2020-12-20 17:04

    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

    0 讨论(0)
提交回复
热议问题