Note 2 doesn't have magnetic sensor. All cover use proximity sensor.
but i had a strange problem..
i was testing the software provided in the OP with a normal flip cover..
its working well when we place our hand or something near to the proximity sensor in good light.
but not in the dark....
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?