使用Firebase实时数据库对象填充数组

时间:2019-04-24 17:36:33

标签: ionic3 angularfire2

我有一个Ionic v3应用程序,需要搜索多个信标。我使用数组中的硬编码值(如下所示)进行处理。我一直在尝试使用Firebase实时数据库中的值填充此数组,以便该应用在加载时更新信标uuid。

database:

App
|____Beacons
       |____-LRw4M3mbHw_Z0ED-vdY
       |       |____module: "b1"
       |       |____uuid: "b0702980-a295-a8ab-f734-031a98a512de"
       |
       |____-LRw4SwKzdL4I2cGd7Am
               |____module: "b2"
               |____uuid: "b9407f30-f5f8-466e-aff9-25556b57fe6d"
//This is the hard-coded array

region: any =
    [
        // Estimote Beacon factory UUID.
        {identifier: 'a1', uuid:'F7826DA6-4FA2-4E98-8024-BC5B71E0893E'},
        // Sample UUIDs
        {identifier: 'a2', uuid:'B9407F30-F5F8-466E-AFF9-25556B57FE6D'},
        {identifier: 'a3', uuid:'B0702980-A295-A8AB-F734-031A98A512DE'},
        {identifier: 'a4', uuid:'636F3F8F-6491-4BEE-95F7-D8CC64A863B5'},
  ];


//This is were it is used


for (let i in this.region) {
        this.beaconRegions = this.ibeacon.BeaconRegion(i+1, this.region[i].uuid);
        //this.ibeacon.BeaconRegion(identifier: String, uuid: String);

        // start ranging
        this.ibeacon.startRangingBeaconsInRegion(this.beaconRegions)
          .then( ... });

任何帮助都会很棒

0 个答案:

没有答案