我为 Beacon 管理创建了 Web 管理界面,用户可以在其中输入他们的 Majorid 和 Minorid 以及各自的信息(元数据)。请看一下JSON。我从问题中提到的 URL 获取 JSON 值。但是我怎样才能为不同的信标创建一组区域。为不同的信标创建区域仍然令人困惑,因为信标将从服务器后端添加。
JSON:
[{"name":"Test","uuid":"B9407F30-F5F8-466E-AFF9-25556B57FE6D","major_id":"23695","minor_id":"46901","notification":"","type":"Image","product_image":"www.justdoonce.com/beacon/staging/images/product_images/visualize2.png"},
{"name":"Test1","uuid":"B9407F30-F5F8-466E-AFF9-25556B57FE6D","major_id":"42583","minor_id":"41770","notification":"","type":"Text","text_text":"<p>test</p>"}]
解析和分配:
major_id= Integer.parseInt(jObject.getString("major_id")) ;
minor_id= Integer.parseInt(jObject.getString("minor_id")) ;
region_server = new Region("region_server", uuid, major_id, minor_id); //creating region
public void onEnteredRegion(final Region region, List<Beacon> beacons) {
if (region.getIdentifier().equals("region_server")) {
notify_image.setVisibility(View.VISIBLE);
}
}