Ali
Ali

Reputation: 166

Android NFC Unresolved reference: setNdefPushMessage

I'm working on an Android application that's supposed to send text data from one phone to another via NFC. I've been referring to the official Android NFC documentation: https://developer.android.com/develop/connectivity/nfc/nfc

In my code, I'm trying to use the setNdefPushMessage method as follows:

import android.nfc.NfcAdapter
...
private var nfcAdapter: NfcAdapter? = null
...
nfcAdapter?.setNdefPushMessage(this, this)

However, I'm encountering an error, which is as follows:

Unresolved reference: setNdefPushMessage

I've searched the android.nfc.NfcAdapter library codes, but I couldn't find the setNdefPushMessage or setNdefPushMessageCallback method. Has this method been removed, or is this an Android Studio issue? Can someone suggest an alternative way to send and receive NFC data on Android?

I've already checked the Android NFC documentation and tried a few things, but I'm not sure how to proceed. Any help or insights would be greatly appreciated.

Additional Information:

Android Studio Giraffe | 2022.3.1 Patch 2
Build #AI-223.8836.35.2231.10811636, built on September 15, 2023
Runtime version: 17.0.6+0-b2043.56-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 12
Registry:
    external.system.auto.import.disabled=true
    debugger.new.tool.window.layout=true
    ide.text.editor.with.preview.show.floating.toolbar=false
    ide.experimental.ui=true

Non-Bundled Plugins:
    com.intellij.marketplace (223.8836.56)
    com.github.copilot (1.2.5.2507)
    izhangzhihao.rainbow.brackets (2023.3.6)
    com.mallowigi (85.1.0)

Upvotes: 6

Views: 1477

Answers (0)

Related Questions