Reputation: 1435
I'm trying to get locslization details of the phone. But it returns an error. Following is the code I hae used, which is the sample of PhoneGap API document (http://docs.phonegap.com/en/2.2.0/cordova_globalization_globalization.md.html).
function checkLocale() {
navigator.globalization.getLocaleName(
function (locale) {alert('locale: ' + locale.value + '\n');},
function () {alert('Error getting locale\n');}
);
}
Your help on this would be greatly appreciated.
Thanks.
Upvotes: 0
Views: 1291
Reputation: 124
I solved it adding permission in phonegap config.xml.
<access origin="*"/> <!-- allow all pages -->
<!--
<access origin="http://phonegap.com" /> - allow any secure requests to http://phonegap.com/
<access origin="http://phonegap.com" subdomains="true" /> - same as above, but including subdomains, such as http://build.phonegap.com/
<access origin="http://phonegap.com" browserOnly="true" /> - only allows http://phonegap.com to be opened by the child browser.
-->
<!-- Globalization plugin configuration-->
<feature name="Globalization">
<param name="android-package" value="org.apache.cordova.globalization.Globalization" />
</feature>
</widget>
Upvotes: 0
Reputation: 2344
I read documentation of your link, and it says that it's needed to give permissions in android:
Permissions
Android
In app/res/xml/config.xml
<plugin name="Globalization" value="org.apache.cordova.Globalization" />
Hope that it helps you. Regards, Daniel
Upvotes: 1