org.altbeacon.beacon.BeaconTransmitter Java Examples

The following examples show how to use org.altbeacon.beacon.BeaconTransmitter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeaconSimulatorFragment.java    From iBeacon-Android with Apache License 2.0 6 votes vote down vote up
private void setupBeacon() {
    beacon = new Beacon.Builder()
            .setId1(getString(R.string.beacon_uuid_simulator)) // UUID for beacon
            .setId2(getString(R.string.beacon_major_simulator)) // Major for beacon
            .setId3(getString(R.string.beacon_minor_simulator)) // Minor for beacon
            .setManufacturer(0x004C) // Radius Networks.0x0118  Change this for other beacon layouts//0x004C for iPhone
            .setTxPower(-56) // Power in dB
            .setDataFields(Arrays.asList(new Long[]{0l})) // Remove this for beacon layouts without d: fields
            .build();

    btManager = (BluetoothManager) getActivity().getSystemService (Context.BLUETOOTH_SERVICE);
    btAdapter = btManager.getAdapter ();

    beaconTransmitter = new BeaconTransmitter (getActivity(), new BeaconParser()
            .setBeaconLayout ("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
}
 
Example #2
Source File: BeaconBroadcast.java    From react-native-ibeacon-simulator with MIT License 5 votes vote down vote up
@Override
public Map<String, Object> getConstants() {
	final Map<String, Object> constants = new HashMap<>();
	constants.put(SUPPORTED, BeaconTransmitter.SUPPORTED);
	constants.put(NOT_SUPPORTED_MIN_SDK, BeaconTransmitter.NOT_SUPPORTED_MIN_SDK);
	constants.put(NOT_SUPPORTED_BLE, BeaconTransmitter.NOT_SUPPORTED_BLE);
	constants.put(NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS, BeaconTransmitter.NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS);
	constants.put(NOT_SUPPORTED_CANNOT_GET_ADVERTISER, BeaconTransmitter.NOT_SUPPORTED_CANNOT_GET_ADVERTISER);
	return constants;
}
 
Example #3
Source File: BeaconBroadcast.java    From react-native-ibeacon-simulator with MIT License 5 votes vote down vote up
@ReactMethod
public void startSharedAdvertisingBeaconWithString(String uuid, int major, int minor,String identifier) {
int manufacturer = 0x4C;
Beacon beacon = new Beacon.Builder()
		.setId1(uuid)
		.setId2(String.valueOf(major))
		.setId3(String.valueOf(minor))
		.setManufacturer(manufacturer)
		.setBluetoothName(identifier)
		.setTxPower(-59)
		.build();
BeaconParser beaconParser = new BeaconParser()
		.setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
this.beaconTransmitter = new BeaconTransmitter(context, beaconParser);
this.beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {

	@Override
	public void onStartFailure(int errorCode) {
		Log.d("ReactNative", "Error from start advertising " + errorCode);
	}

	@Override
	public void onStartSuccess(AdvertiseSettings settingsInEffect) {
		Log.d("ReactNative", "Success start advertising");
	}
});
}
 
Example #4
Source File: BeaconsAndroidModule.java    From react-native-beacons-android with MIT License 5 votes vote down vote up
@Override
public Map<String, Object> getConstants() {
    final Map<String, Object> constants = new HashMap<>();
    constants.put("SUPPORTED", BeaconTransmitter.SUPPORTED);
    constants.put("NOT_SUPPORTED_MIN_SDK", BeaconTransmitter.NOT_SUPPORTED_MIN_SDK);
    constants.put("NOT_SUPPORTED_BLE", BeaconTransmitter.NOT_SUPPORTED_BLE);
    constants.put("NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS", BeaconTransmitter.NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS);
    constants.put("NOT_SUPPORTED_CANNOT_GET_ADVERTISER", BeaconTransmitter.NOT_SUPPORTED_CANNOT_GET_ADVERTISER);
    return constants;
}
 
Example #5
Source File: BeaconBroadcast.java    From react-native-ibeacon-simulator with MIT License 4 votes vote down vote up
@ReactMethod
public void checkTransmissionSupported(Callback cb) {
	int result = BeaconTransmitter.checkTransmissionSupported(context);
	cb.invoke(result);
}
 
Example #6
Source File: BeaconsAndroidModule.java    From react-native-beacons-android with MIT License 4 votes vote down vote up
@ReactMethod
public void checkTransmissionSupported(Callback callback) {
    int result = BeaconTransmitter.checkTransmissionSupported(mReactContext);
    callback.invoke(result);
}