'"Pointer location" feature data extraction

I'm an undergraduate doing my FYP on continuous authentication in android phones. I need to build an app that runs in the background and monitors the touch coordinates of the user and records them into a file. I'm pretty impressed about the Developer Options feature Pointer location. Is it possible to get the coordinates values from the Pointer location?

I have tried almost everything on the internet still I'm finding it difficult to build one.

Please help me find a solution.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source