Updated on 2026-08-14

This commit is contained in:
Tangem 2018-07-13 12:03:02 +03:00
parent b690338759
commit f7bd06e040
6 changed files with 297 additions and 23 deletions

View file

@ -15,6 +15,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.widget.Toast;
import com.tangem.presentation.dialog.NFCEnableDialog;
@ -76,6 +77,27 @@ public class NfcManager {
// }
}
int errorCount=0;
public void notifyReadResult(boolean success)
{
if(success)
{
errorCount=0;
}else{
errorCount++;
}
if( errorCount>=3 )
{
disableReaderMode();
mNfcAdapter=null;
Toast.makeText(mActivity,"NFC restarted!",Toast.LENGTH_SHORT).show();
mActivity.runOnUiThread(()->{
mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity);
enableReaderMode();
});
}
}
private void showNFCEnableDialog() {
mEnableNfcDialog = new NFCEnableDialog();
mEnableNfcDialog.show(mActivity.getFragmentManager(), NFCEnableDialog.TAG);