I can think of a few options. The list is provided below and it is ordered by least effort needed and on the other hand how accurate will the information be.
- Use user's locale string provided by Globalization plugin, it may contain the country code next to language code such as "en-US" or "en-GB".
Usage
function successCallback(obj) {
var locale = obj.value;
}
navigator.globalization.getPreferredLanguage(successCallback, errorCallback);
- Only for Android: Use plugin such as Device Information plugin which allows you to access the Android's Telephony Manager's information. From this information you are able to get the
Country ISO of your phone network provider
according to the plugin author. To use the plugin your code would look something like this
deviceInfo.get(function(result) {
console.log("result = " + result);
}, function() {
console.log("error");
});
where the result will contain your netCountry called field as part of the string returned.
- Figure the GPS to country conversion by yourself based on the country borders as GPS. One possible map (dataset) is available [here](World Borders Dataset). I would though recommend just using some external API to give that information for you.