Without TPL library download exe from here source code from here. If you need XML files good and wrong for tests, download from here.
With TPL library download from here , source from here
Source you can also find on GitHub
This is my example of using GPS in Android device, this application will every user defined seconds (default 30) save a file with GPS longitude/latitude as a JSON node.
Please note that it was only tested with Huawei P30 lite, and Android 10, also please note that the files will never be deleted, you have to delete them manually. Files are located somewhere in \Android\data\com.milosev.justanotherrealtimetrackingapp\files\locations.
Source code download from here, APK from here, GitHub here.