如何让Geolocation API在Dartium中工作? [英] How do I get Geolocation API to work in Dartium?

查看:238
本文介绍了如何让Geolocation API在Dartium中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Geolocation API在Dartium浏览器中测试。特别是我试着做下面的事情。

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"))
    ;

忽略我在这里使用window.alert的事实,我得到的是一个错误,消息错误代码:2,错误消息:网络位置提供商位于 https://www.googleapis.com/':返回错误代码400。

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."

但是,当我使用pub服务时,同样的代码在Google Chrome中可以使用。它也适用于Firefox。我如何克服这个错误,并让它在Dartium工作?是否可能?

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?

我看了一下403错误,在此页面 http://www.chromium.org/developers/how-tos/ api-keys ,当我第一次尝试这个,我得到我的凭据和设置错误,我得到一个403错误,但一旦解决,所有的API启用,加上环境设置

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

我回到 https://www.googleapis上的网络位置提供商 .com / ':返回错误代码400.,所以我推断这是不一样的问题。

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.

这是一个错误。

推荐答案

这是一个错误。

我在 https://上发布了此问题groups.google.com/a/dartlang.org/forum/#!topic/web/UMJHJlQH7wc ,其中Seth Ladd要求我打开一个错误。

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.

我为此打开了一个错误, https://code.google .com / p / dart / issues / detail?id = 15866 。所以希望这将很快解决。

I've opened a bug for this, https://code.google.com/p/dart/issues/detail?id=15866. So hopefully this will be resolved soon.

这篇关于如何让Geolocation API在Dartium中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆