Android: how to detect when settings were changed using the Extract Output menu?

In my application, I need NFC (although anyone who requires GPS will run into this too). In my MainActivity, I check that NFC is enabled in my method onResume

.

When someone pulls out the notification bar, they can choose to change many of the settings at the very top, including GPS and NFC. I was surprised to find out that the app does not call onPause

when the notification menu is disabled. By disabling NFC through the notification menu, the user bypasses my app layer (at least temporarily).

Is there a way to mitigate this? I suppose I could constantly check if the NFC is working every few seconds, but I think this is too much.

A very sketchy way to do this would be to somehow catch on to the fact that the screen dims when you slide down, and brightens the backup when you slide down the notification menu ... It could only be my phone. It's pretty cumbersome.

+3


source to share


1 answer


there are broadcasts for receiving status changes:



register / unregister to listen to them during onResume / onPause

+1


source







All Articles