How to PROPERLY check for latest app version

From what I can imagine there’s 3 ways to know what is the latest versions:
1 - Check what is the latest version from a JSON file in the server
2 - Check what is the latest version from a table in the db
3 - Check what is the latest version from the app store itself

I know how to do 1 and 2 but I’ve searched on google and I don’t find how to do number 3 which would be the ideal one, do you guys know how do to it? If 3 ends up not working, which one do you guys recommend using, 1 or 2 ?

Also I have one more doubt:
In config.xml I can find version=“0.0.1” and that’s where I would expect to modify it too, but what’s up with this “version”: “0.0.1” in package.json ? do I have to change that one too or does changing one change the other?