本文整理汇总了Java中org.altbeacon.beacon.BeaconTransmitter类的典型用法代码示例。如果您正苦于以下问题:Java BeaconTransmitter类的具体用法?Java BeaconTransmitter怎么用?Java BeaconTransmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeaconTransmitter类属于org.altbeacon.beacon包,在下文中一共展示了BeaconTransmitter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startTransmission
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
/**
* Start transmitting as beacon.
*/
@Override
public void startTransmission() {
if (checkPrerequisites()) {
// Sets up to transmit as an AltBeacon-style beacon. If you wish to transmit as a different
// type of beacon, simply provide a different parser expression. To find other parser expressions,
// for other beacon types, do a Google search for "setBeaconLayout" including the quotes
mBeaconTransmitter = new org.altbeacon.beacon.BeaconTransmitter(mContext,
new BeaconParser().setBeaconLayout(BeaconMock.ALT_BEACON_LAYOUT));
// Transmit a beacon with Identifiers 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 1 2
org.altbeacon.beacon.Beacon beacon = new org.altbeacon.beacon.Beacon.Builder()
.setId1(BEACON_ID_1)
.setId2(BEACON_ID_2)
.setId3(BEACON_ID_3)
.setManufacturer(0x0000) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setTxPower(-59)
.setDataFields(Collections.singletonList(0L))
.build();
mBeaconTransmitter.startAdvertising(beacon);
}
}
开发者ID:kevalpatel2106,项目名称:robo-car,代码行数:26,代码来源:Beacon.java
示例2: broadcastAsBeacon
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
public void broadcastAsBeacon() {
Beacon beacon = new Beacon.Builder()
.setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setId2("1")
.setId3("2")
.setManufacturer(0x0118) // Radius Networks. Change this for other beacon layouts
.setTxPower(-59)
.setDataFields(Arrays.asList(new Long[]{0l})) // Remove this for beacon layouts without d: fields
.build();
// Change the layout below for other beacon types
BeaconParser beaconParser = new BeaconParser()
.setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
BeaconTransmitter beaconTransmitter = new BeaconTransmitter(context, beaconParser);
beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
@Override
public void onStartFailure(int errorCode) {
Log.e("Class", "Advertisement start failed with code: " + errorCode);
}
@Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
Log.i("class", "Advertisement start succeeded.");
}
});
}
开发者ID:MycroftAI,项目名称:Mycroft-Android,代码行数:27,代码来源:BeaconUtil.java
示例3: startTransmitting
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
private void startTransmitting() {
try {
if (!beaconManager.checkAvailability()) {
requestBluetooth();
} else {
if (!(BeaconTransmitter.checkTransmissionSupported(getActivity()) == BeaconTransmitter.SUPPORTED)) {
notifyTransmittingNotSupported();
} else if (transmitter != null) {
isTransmitting = true;
switchModeLayout.setVisibility(View.INVISIBLE);
transmitter.startTransmitting();
startAnimation();
}
}
} catch (BleNotAvailableException bleNotAvailableException) {
notifyTransmittingNotSupported();
}
}
开发者ID:BoydHogerheijde,项目名称:Beacon-Scanner-Android,代码行数:19,代码来源:MainFragment.java
示例4: getConstants
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
@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;
}
开发者ID:williamtran29,项目名称:react-native-ibeacon-simulator,代码行数:11,代码来源:BeaconBroadcast.java
示例5: startSharedAdvertisingBeaconWithString
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
@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");
}
});
}
开发者ID:williamtran29,项目名称:react-native-ibeacon-simulator,代码行数:28,代码来源:BeaconBroadcast.java
示例6: getConstants
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
@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;
}
开发者ID:MacKentoch,项目名称:react-native-ibeacons,代码行数:11,代码来源:BeaconsAndroidModule.java
示例7: startBeaconAdvertisement
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
/**
* Creates a new Altbeacon advertisement - COMPLETELY UNTESTED
* Code adapted from http://altbeacon.github.io/android-beacon-library/beacon-transmitter.html
*/@Kroll.method
public void startBeaconAdvertisement(Object beaconData) {
HashMap < String, Object > dict = (HashMap < String, Object > ) beaconData;
String id1 = TiConvert.toString(dict, "uuid");
String id2 = TiConvert.toString(dict, "major");
String id3 = TiConvert.toString(dict, "minor");
int mfrID = TiConvert.toInt(dict, "mfrid");
int txPower = TiConvert.toInt(dict, "txpower");
Builder builder = new Beacon.Builder().setId1(id1).setId2(id2).setId3(id3).setManufacturer(mfrID).setTxPower(txPower);
Object[] dataObj = (Object[]) dict.get("data");
if (dataObj != null) {
String[] dataStr = TiConvert.toStringArray(dataObj);
ArrayList < Long > data = new ArrayList < Long > ();
for (String s: dataStr) {
data.add(Long.parseLong(s));
}
builder.setDataFields(data);
}
String layout = TiConvert.toString(dict, "layout");
BeaconParser parser = new BeaconParser().setBeaconLayout(layout);
beaconTransmitter = new BeaconTransmitter(getApplicationContext(), parser);
beaconTransmitter.startAdvertising(builder.build());
}
开发者ID:dwk5123,项目名称:android-altbeacon-module,代码行数:31,代码来源:AndroidAltbeaconModuleModule.java
示例8: checkTransmissionSupported
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
@ReactMethod
public void checkTransmissionSupported(Callback cb) {
int result = BeaconTransmitter.checkTransmissionSupported(context);
cb.invoke(result);
}
开发者ID:williamtran29,项目名称:react-native-ibeacon-simulator,代码行数:6,代码来源:BeaconBroadcast.java
示例9: checkTransmissionSupported
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
@ReactMethod
public void checkTransmissionSupported(Callback callback) {
int result = BeaconTransmitter.checkTransmissionSupported(mReactContext);
callback.invoke(result);
}
开发者ID:MacKentoch,项目名称:react-native-ibeacons,代码行数:6,代码来源:BeaconsAndroidModule.java
示例10: setUpTransmitter
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
private void setUpTransmitter() {
BeaconParser beaconParser = new BeaconParser().setBeaconLayout(BeaconParser.ALTBEACON_LAYOUT);
beaconTransmitter = new BeaconTransmitter(context, beaconParser);
beaconTransmitter.setBeacon(createBeacon());
}
开发者ID:berger89,项目名称:beacon-finder,代码行数:6,代码来源:Transmitter.java
示例11: isTransmissionSupported
import org.altbeacon.beacon.BeaconTransmitter; //导入依赖的package包/类
/**
* Checks to see if Altbeacon advertisement/transmission is supported on the device
*/@Kroll.method
public boolean isTransmissionSupported() {
return (BeaconTransmitter.checkTransmissionSupported(getApplicationContext()) == BeaconTransmitter.SUPPORTED);
}
开发者ID:dwk5123,项目名称:android-altbeacon-module,代码行数:7,代码来源:AndroidAltbeaconModuleModule.java
注:本文中的org.altbeacon.beacon.BeaconTransmitter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论