NFC service dead - attempting to recover

孤街浪徒 提交于 2019-12-23 11:46:25

问题


I have an application which reads & writes the data into the NFC tag(Type 2). Some times while reading the tag i am getting the below error in LogCat.

03-13 12:26:12.946: E/NFC(18889): NFC service dead - attempting to recover
03-13 12:26:12.946: E/NFC(18889): android.os.DeadObjectException
03-13 12:26:12.946: E/NFC(18889):   at android.os.BinderProxy.transact(Native Method)
03-13 12:26:12.946: E/NFC(18889):   at android.nfc.INfcAdapter$Stub$Proxy.setForegroundDispatch(INfcAdapter.java:350)
03-13 12:26:12.946: E/NFC(18889):   at android.nfc.NfcAdapter.disableForegroundDispatchInternal(NfcAdapter.java:1062)
03-13 12:26:12.946: E/NFC(18889):   at android.nfc.NfcAdapter.disableForegroundDispatch(NfcAdapter.java:1050)

Does any have any idea why is this happening. Is there any way to fix this.

Thanks.


回答1:


I have come across the same issue and was able to resolve. This happens when you try to invoke NFC beam, when Activity is not in Resumed State.

NFCBeamShareData checks if the current activity is in resume state. If the current activity is not in resume state, it will return null object and causes NullPointerException or DeadObjectException.



来源:https://stackoverflow.com/questions/22371843/nfc-service-dead-attempting-to-recover

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!