I'm trying to test in Dartium browser using the Geolocation API. In particular I try doing the following
window.navigator
.geolocation.getCurrentPosition()
..then((pos) {
window.alert(pos.toString());
})
..catchError((PositionError error) {
window.alert("Error code: ${error.code}, Error message: ${error.message}");
})
..whenComplete(() => window.alert("complete"))
;
Ignoring the fact I'm using window.alert here, All I get is an error with the following message "Error code: 2, Error message: Network location provider at 'https://www.googleapis.com/' : Returned error code 400."
However the same code works in Google Chrome when I use "pub serve". It also works with Firefox. How do I overcome this error, and get it to work in Dartium? Is it even possible?
UPDATE
I took a look at the 403 bug and tried using the fix specified on this page http://www.chromium.org/developers/how-tos/api-keys, and when I first tried this, I got my credentials and setting wrong, I was getting a 403 error, but once that was resolved, and all the APIs enabled, plus the environment settings of
GOOGLE_API_KEY
GOOGLE_DEFAULT_CLIENT_ID
GOOGLE_DEFAULT_CLIENT_SECRET
I was back to "Network location provider at 'https://www.googleapis.com/' : Returned error code 400.", so I conclude it isn't the same issue. Though if someone can prove me wrong, I'd be happy.
FURTHER UPDATE
This is a bug. I've answered my own question below.
This is a bug.
I posted this question on https://groups.google.com/a/dartlang.org/forum/#!topic/web/UMJHJlQH7wc, where Seth Ladd asked me to open a bug.
I've opened a bug for this, https://code.google.com/p/dart/issues/detail?id=15866. So hopefully this will be resolved soon.
Maybe you are running into this issue
Geolocation giving 403 error
Should be fixable by providing Google API keys for Dartium