-
public class BeaconTransmitter
Provides a mechanism for transmitting as a beacon. Requires Android 5.0
-
-
Field Summary
Fields Modifier and Type Field Description public final static int
SUPPORTED
public final static int
NOT_SUPPORTED_MIN_SDK
public final static int
NOT_SUPPORTED_BLE
public final static int
NOT_SUPPORTED_MULTIPLE_ADVERTISEMENTS
public final static int
NOT_SUPPORTED_CANNOT_GET_ADVERTISER
public final static int
NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS
-
Constructor Summary
Constructors Constructor Description BeaconTransmitter(Context context, BeaconParser parser)
Creates a new beacon transmitter capable of transmitting beacons with the format specified in the BeaconParser and with the data fields specified in the Beacon object
-
Method Summary
Modifier and Type Method Description boolean
isStarted()
Tells if transmission has started void
setBeacon(Beacon beacon)
Sets the beacon whose fields will be transmitted void
setBeaconParser(BeaconParser beaconParser)
Sets the beaconParsser used for formatting the transmission int
getAdvertiseMode()
void
setAdvertiseMode(int mAdvertiseMode)
AdvertiseSettings.ADVERTISE_MODE_BALANCED 3 Hz AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY 10 Hz AdvertiseSettings. int
getAdvertiseTxPowerLevel()
void
setAdvertiseTxPowerLevel(int mAdvertiseTxPowerLevel)
AdvertiseSettings.ADVERTISE_TX_POWER_HIGH -56 dBm @ 1 meter with Nexus 5 AdvertiseSettings.ADVERTISE_TX_POWER_LOW -75 dBm @ 1 meter with Nexus 5 AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM -66 dBm @ 1 meter with Nexus 5 AdvertiseSettings. void
setConnectable(boolean connectable)
Whether the advertisement should indicate the device is connectable. boolean
isConnectable()
void
startAdvertising(Beacon beacon)
Starts advertising with fields from the passed beacon void
startAdvertising(Beacon beacon, AdvertiseCallback callback)
Starts advertising with fields from the passed beacon void
startAdvertising()
Starts this beacon advertising void
stopAdvertising()
Stops this beacon from advertising static int
checkTransmissionSupported(Context context)
Checks to see if this device supports beacon advertising -
-
Constructor Detail
-
BeaconTransmitter
BeaconTransmitter(Context context, BeaconParser parser)
Creates a new beacon transmitter capable of transmitting beacons with the format specified in the BeaconParser and with the data fields specified in the Beacon object- Parameters:
parser
- specifies the format of the beacon transmission
-
-
Method Detail
-
isStarted
boolean isStarted()
Tells if transmission has started
-
setBeaconParser
void setBeaconParser(BeaconParser beaconParser)
Sets the beaconParsser used for formatting the transmission
-
getAdvertiseMode
int getAdvertiseMode()
-
setAdvertiseMode
void setAdvertiseMode(int mAdvertiseMode)
AdvertiseSettings.ADVERTISE_MODE_BALANCED 3 Hz AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY 10 Hz AdvertiseSettings.ADVERTISE_MODE_LOW_POWER 1 Hz
-
getAdvertiseTxPowerLevel
int getAdvertiseTxPowerLevel()
-
setAdvertiseTxPowerLevel
void setAdvertiseTxPowerLevel(int mAdvertiseTxPowerLevel)
AdvertiseSettings.ADVERTISE_TX_POWER_HIGH -56 dBm @ 1 meter with Nexus 5 AdvertiseSettings.ADVERTISE_TX_POWER_LOW -75 dBm @ 1 meter with Nexus 5 AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM -66 dBm @ 1 meter with Nexus 5 AdvertiseSettings.ADVERTISE_TX_POWER_ULTRA_LOW not detected with Nexus 5
-
setConnectable
void setConnectable(boolean connectable)
Whether the advertisement should indicate the device is connectable.
-
isConnectable
boolean isConnectable()
-
startAdvertising
void startAdvertising(Beacon beacon)
Starts advertising with fields from the passed beacon
-
startAdvertising
void startAdvertising(Beacon beacon, AdvertiseCallback callback)
Starts advertising with fields from the passed beacon
-
startAdvertising
void startAdvertising()
Starts this beacon advertising
-
stopAdvertising
void stopAdvertising()
Stops this beacon from advertising
-
checkTransmissionSupported
static int checkTransmissionSupported(Context context)
Checks to see if this device supports beacon advertising
-
-
-
-