I'm developping an app for Samsung devices with an activity that has to handle a NFC tag..
This activity is called when the app is launched and on resume.
I noticed that, when the phone stays awake with the NFC tag connected to it, after a while the device stops recognizing/scanning for NFC tags.
After trying with some other applications from Play Store, I noticed that this doesn't happen only with my app.
All I can do to make it work again is to switch phone's screen on/off or to switch nfc on/off.
I tried different ways to fix it, as to keep the cpu running, but none of these methods worked :
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Tag");
wl.acquire();
and
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
The only post about my problem that I found is : onTagDiscovered() not called any more when nfc tag already there after updating from 4.4.4 to 5.1.1 Samsung
Unfortunately, I'm working over non-rooted phones, and I'm not able to get a Samsung Knox licence (unless it is free ?)
Thanks in advance
EDIT
Tried with
setKeepScreenOn(true);
But still no change about this bug