Buildfire:buildfire.geo.getCurrentPosition不适用于移动应用程序(包括android和ios)和PWA

时间:2017-12-13 09:17:47

标签: buildfire

我有一个页面,我需要在设备的当前位置获取用户的当前位置,我已经使用了" buildfire.geo.getCurrentPosition",它正在使用localhost发展,但在发布期间,它没有工作。

buildfire.geo.getCurrentPosition(null, (err, position) => {
  if(err)
    console.log(err);
  else {
    let currentLoc = this.state.currentLoc;
    currentLoc['coordinates'] = {lat: position.coords.latitude, lng: position.coords.longitude};
    this.setState({currentLoc});
  }
});

Working on localhost

But not on the app control panel upon updating the plugin

2 个答案:

答案 0 :(得分:0)

确保检查位置的插件具有plugin.json文件中指定的相应功能。

这是一个示例plugin.json示例,其中包含该功能。

{
  "author":"Jane Doe"
  ,"pluginName":"Sample Plugin "
  ,"pluginDescription":"This is an example"
  ,"supportEmail":"support@buildfire.com"
  ,"control":{
    "content":{
      "enabled":true
    }
    , "design":{
      "enabled":true
    }
    , "settings":{
      "enabled":false
    }
  },
  "features" : [{"name" : "GEO"}],
  "languages" : ["en"],
}

请注意,向plugin.json添加新功能需要对应用进行硬构建,因此您不会立即看到更改。

答案 1 :(得分:0)

我已将该功能添加到plugin.json文件中。

    {
  "author": "Sio Donayre"
  ,"pluginName": "Coupon Plugin"
  ,"pluginDescription": "Simple Discount Coupon Plugin"
  ,"supportEmail": "sio.donayre@go-va.com.au"
  ,"control": {
    "content": {
      "enabled": true
    }
  , "design": {
      "enabled": false
    }
  , "settings": {
      "enabled": false
    }
  }
  ,"widget": {},
  "features" : [
    {
      "name": "GEO"
    },
    {
      "name" : "Calendar"
    }
  ],
  "languages" : ["en"]
}