Reply To: Crash when executing startForeGroundDispatch

Forum MIFARE SDK Crash when executing startForeGroundDispatch Reply To: Crash when executing startForeGroundDispatch

Re: Crash when executing startForeGroundDispatch

7. March 2017 at 10:53
Hi, thanks for your reply. What startForeGroundDispatch does internally is to call the NfcAdapter#enableForegroundDispatch method which according to the Android documentation must to be called from onResume ("...enableForegroundDispatch() must be called from the main thread and only when the activity is in the foreground (calling in onResume() guarantees this)") https://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html#foreground-dispatch

On the other hand the sample application that you provide (https://www.mifare.net/wp-content/uploads/2016/08/SrcsampleNxpNfcLib-1.0.zip) calls startForeGroundDispatch from onResume. Where should I call startForeGroundDispatch method from?

Cheers.
+ 0  |  - 0