How to get my longitude and latitute, and compare it

I wish my ionic app to get my longitude and latitude, store it and later compare it with another longitude and latitude to get the distance between them.
This my first project with ionic and wish to know the best solution to implement. I do not intend to present my data on a map. Thank you in advance.