本文整理汇总了Java中org.altbeacon.beacon.Identifier.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Identifier.parse方法的具体用法?Java Identifier.parse怎么用?Java Identifier.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.altbeacon.beacon.Identifier
的用法示例。
在下文中一共展示了Identifier.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BleManager
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
@Inject
public BleManager(@ForApplication Context context, PreferenceManager prefsManager) {
this.context = context;
// the app manifest requires support for BLE, no need to check explicitly
bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
bluetoothAdapter = bluetoothManager.getAdapter();
preferenceManager = prefsManager;
gattManager = new GattManager(prefsManager, this);
// Beaconing
beaconManager = org.altbeacon.beacon.BeaconManager.getInstanceForApplication(context);
beaconManager.getBeaconParsers().clear();
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
Timber.d("setting up background monitoring for beacons and power saving");
Identifier id1 = Identifier.parse(ThunderBoardDevice.THUNDER_BOARD_REACT_UUID_STRING);
Region region = new Region("backgroundRegion", id1, null, null);
regionBootstrap = new ThunderBoardBootstrap(context, this, region);
backgroundPowerSaver = new ThunderBoardPowerSaver(context, preferenceManager);
beaconManager.setBackgroundBetweenScanPeriod(ThunderBoardPowerSaver.DELAY_BETWEEN_SCANS_INACTIVE);
}
示例2: startBeaconService
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
/**
* Start the XamoomBeaconService with a beacon majorId.
* This will automatically start (background-)monitoring for xamoom beacons
* with the used majorId.
*
* @param majorId MajorId you get from your xamoom system.
*/
public void startBeaconService(@NonNull String majorId) {
Log.i(TAG, "startBeaconService");
if (majorId.equalsIgnoreCase("")) {
throw new IllegalArgumentException("MajorId should not be a number.");
}
mRegion = new Region("test", Identifier.parse("de2b94ae-ed98-11e4-3432-78616d6f6f6d"),
Identifier.parse(majorId), null);
mRegionBootstrap = new RegionBootstrap(this, mRegion);
mBeaconManager = BeaconManager.getInstanceForApplication(mContext);
mBeaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
mBeaconManager.setRangeNotifier(this);
mBeaconManager.bind(this);
}
示例3: onCreate
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
SmartBeaconProvider provider = new SmartBeaconProvider();
/**
* Region represented by all SmartBeacon's beacons
*/
Region region = new Region(REGION_ID, Identifier.parse(provider.getProximityUuid()), null, null);
try {
getBeaconManager().startMonitoringBeaconsInRegion(region);
getBeaconManager().startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
Log.e(TAG, "An error occus on start monitor/range region!");
}
}
示例4: startSearchForBeacons
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
private void startSearchForBeacons() {
List<BeaconResult> beacons = beaconPersistence.getBeacons();
List<Region> regions = new ArrayList<>(beacons.size());
for (BeaconResult beacon : beacons) {
String id = beacon.getUuid() + beacon.getMajor() + beacon.getMinor();
try {
Region region = new Region(id,
Identifier.parse(beacon.getUuid()),
Identifier.parse(beacon.getMajor()),
Identifier.parse(beacon.getMinor()));
regions.add(region);
} catch (IllegalArgumentException e) {
String informalName = beacon.getInformalName();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(getString(R.string.not_able_to_start_monitoring_for_beacon_error_1));
if (informalName != null && !informalName.isEmpty()) {
stringBuilder.append("name: \"").append(informalName).append("\" with ");
}
stringBuilder.append("uuid: \"").append(beacon.getUuid()).append("\" major: \"").append(beacon.getMajor()).append("\" minor: \"").append(beacon.getMinor()).append("\"");
String errorMessage = stringBuilder.toString();
Log.e(TAG, errorMessage, e);
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
}
}
regionBootstrap = new RegionBootstrap(this, regions);
}
示例5: onBeaconServiceConnect
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
/**
* Method reserved for system use
*/
@Override
public void onBeaconServiceConnect() {
Timber.d("Activating background region monitoring");
beaconManager.setRangeNotifier(rangeNotifier);
try {
Identifier id1 = Identifier.parse("cef797da-2e91-4ea4-a424-f45082ac0682");
beaconManager.startRangingBeaconsInRegion(new Region("ThunderBoardUniqueId", id1, null, null));
} catch (RemoteException e) {
Timber.d("Can't set up bootstrap regions, exception: %s", e.getMessage());
}
}
示例6: addNewRegion
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
private void addNewRegion(BeaconModel bm) {
Region region = new Region(bm.getUniqueId(), Identifier.parse(bm.getProximityUUID()), Identifier.parse(bm.getProximityMajor().toString()), Identifier.parse(bm.getProximityMinor().toString()));
try {
beaconManager.startMonitoringBeaconsInRegion(region);
beaconManager.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
ULog.e(TAG, "Cannot start monitor/range region.", e);
}
}
示例7: setupBeaconManager
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
public void setupBeaconManager(){
if (beaconManager==null && AppPreferences.getBeaconDetectionState()) {
AppPreferences.setBeaconDetected(false);
Log.d(TAG, "Init beacon");
beaconManager = BeaconManager.getInstanceForApplication(this);
// To detect proprietary beacons, you must add a line like below corresponding to your beacon
// type. Do a web search for "setBeaconLayout" to get the proper expression.
beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
beaconManager.setBackgroundScanPeriod(2000l);
beaconManager.setBackgroundBetweenScanPeriod(5000l); // (300000l) every 5 minutes
// wake up the app when any beacon is seen (you can specify specific id filers in the parameters below)
region = new Region(REGION_NAME, Identifier.parse(AppPreferences.getBeaconUuid()), null, null);
regionBootstrap = new RegionBootstrap(this, region);
}
}
示例8: onCreate
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAllBeaconsRegion = new Region(UNIQUE_ID, Identifier.parse(PROXIMITY_UUID), null, null);
beaconManager = BeaconManager.getInstanceForApplication(this);
beaconManager.getBeaconParsers().add(new BeaconParser()
.setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
beaconManager.bind(this);
}
示例9: startMonitoringForRegion
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
/**
* Start monitoring a region.
* @param region the region to monitor, expected to be a property dictionary from javascript code.
*/
@Kroll.method
public void startMonitoringForRegion(Object region) {
Log.d(LCAT, "startMonitoringForRegion: " + region);
if (!checkAvailability()) {
Log.d(LCAT, "Bluetooth LE not available or no permissions on this device");
return;
}
try {
HashMap < String, Object > dict = (HashMap < String, Object > ) region;
String identifier = TiConvert.toString(dict, "identifier");
String uuid = TiConvert.toString(dict, "uuid").toLowerCase();
Integer major = (dict.get("major") != null) ? TiConvert.toInt(dict, "major") : null;
Integer minor = (dict.get("minor") != null) ? TiConvert.toInt(dict, "minor") : null;
Identifier id1 = Identifier.parse(uuid);
Identifier id2 = (major == null) ? null : Identifier.fromInt(major);
Identifier id3 = (minor == null) ? null : Identifier.fromInt(minor);
//Region r = new Region(identifier, uuid, major, minor);
Region r = new Region(identifier, id1, id2, id3);
Log.d(LCAT, "Beginning to monitor region " + r);
beaconManager.startMonitoringBeaconsInRegion(r);
} catch (RemoteException ex) {
Log.e(LCAT, "Cannot start monitoring region " + TiConvert.toString(region, "identifier"), ex);
}
}
示例10: startRangingForRegion
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
/**
* Start ranging a region. You can only range regions into which you have entered.
*
* @param region the region to range, expected to be a property dictionary from javascript code.
*/
@Kroll.method
public void startRangingForRegion(Object region) {
Log.d(LCAT, "startRangingForRegion: " + region);
if (!checkAvailability()) {
Log.d(LCAT, "Bluetooth LE not available or no permissions on this device");
return;
}
try {
HashMap < String, Object > dict = (HashMap < String, Object > ) region;
String identifier = dict.get("identifier").toString(); //TiConvert.toString(dict, "identifier");
String uuid = dict.get("uuid").toString(); //TiConvert.toString(dict, "uuid").toLowerCase();
Integer major = (dict.get("major") != null) ? TiConvert.toInt(dict, "major") : null;
Integer minor = (dict.get("minor") != null) ? TiConvert.toInt(dict, "minor") : null;
Identifier id1 = Identifier.parse(uuid);
Identifier id2 = (major == null) ? null : Identifier.fromInt(major);
Identifier id3 = (minor == null) ? null : Identifier.fromInt(minor);
Region r = new Region(identifier, id1, id2, id3);
Log.d(LCAT, "Beginning to monitor region " + r);
beaconManager.startRangingBeaconsInRegion(r);
} catch (RemoteException ex) {
Log.e(LCAT, "Cannot start ranging region " + TiConvert.toString(region, "identifier"), ex);
}
}
示例11: getSelectedRegion
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
public Region getSelectedRegion() {
String uuid = prefs.getString(KEY_UUID, "");
int major = prefs.getInt(KEY_MAJOR, 0);
int minor = prefs.getInt(KEY_MINOR, 0);
if (uuid.equals("")) {
return null;
} else {
return new Region(generateLabel(uuid,major,minor),
Identifier.parse(uuid),
Identifier.fromInt(major),
Identifier.fromInt(minor));
}
}
示例12: createRegion
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
private Region createRegion(String regionId, String beaconUuid) {
Identifier id1 = (beaconUuid == null) ? null : Identifier.parse(beaconUuid);
return new Region(regionId, id1, null, null);
}
示例13: getId2
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
public Identifier getId2() {
if (isEddyStoneURL()) {
return Identifier.parse("");
}
return super.getId2();
}
示例14: getId3
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
public Identifier getId3() {
if (isEddystone()) {
return Identifier.parse("");
}
return super.getId3();
}
示例15: add
import org.altbeacon.beacon.Identifier; //导入方法依赖的package包/类
public void add(String uuid) {
PILogger.d(TAG, "adding uuid region: " + uuid);
Region uuidRegion = new Region(uuid, Identifier.parse(uuid), null, null);
handleAddUuidRegion(uuidRegion);
}