Class BeaconTransmitter


  • public class BeaconTransmitter
    extends Object
    Provides a mechanism for transmitting as a beacon. Requires Android 5.0
    • Field Detail

      • NOT_SUPPORTED_CANNOT_GET_ADVERTISER

        public static final int NOT_SUPPORTED_CANNOT_GET_ADVERTISER
        See Also:
        Constant Field Values
      • NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS

        public static final int NOT_SUPPORTED_CANNOT_GET_ADVERTISER_MULTIPLE_ADVERTISEMENTS
        See Also:
        Constant Field Values
    • Constructor Detail

      • BeaconTransmitter

        public 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:
        context -
        parser - specifies the format of the beacon transmission
    • Method Detail

      • isStarted

        public boolean isStarted()
        Tells if transmission has started
        Returns:
      • setBeacon

        public void setBeacon​(Beacon beacon)
        Sets the beacon whose fields will be transmitted
        Parameters:
        beacon -
      • setBeaconParser

        public void setBeaconParser​(BeaconParser beaconParser)
        Sets the beaconParsser used for formatting the transmission
        Parameters:
        beaconParser -
      • getAdvertiseMode

        public int getAdvertiseMode()
        Returns:
        advertiseMode
        See Also:
        setAdvertiseMode(int)
      • setAdvertiseMode

        public void setAdvertiseMode​(int mAdvertiseMode)
        AdvertiseSettings.ADVERTISE_MODE_BALANCED 3 Hz AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY 10 Hz AdvertiseSettings.ADVERTISE_MODE_LOW_POWER 1 Hz
        Parameters:
        mAdvertiseMode -
      • setAdvertiseTxPowerLevel

        public 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
        Parameters:
        mAdvertiseTxPowerLevel -
      • setConnectable

        public void setConnectable​(boolean connectable)
        Whether the advertisement should indicate the device is connectable.
        Parameters:
        connectable -
      • startAdvertising

        public void startAdvertising​(Beacon beacon)
        Starts advertising with fields from the passed beacon
        Parameters:
        beacon -
      • startAdvertising

        public void startAdvertising​(Beacon beacon,
                                     AdvertiseCallback callback)
        Starts advertising with fields from the passed beacon
        Parameters:
        beacon -
      • startAdvertising

        public void startAdvertising()
        Starts this beacon advertising
      • stopAdvertising

        public void stopAdvertising()
        Stops this beacon from advertising
      • checkTransmissionSupported

        public static int checkTransmissionSupported​(Context context)
        Checks to see if this device supports beacon advertising
        Returns:
        SUPPORTED if yes, otherwise: NOT_SUPPORTED_MIN_SDK NOT_SUPPORTED_BLE NOT_SUPPORTED_MULTIPLE_ADVERTISEMENTS NOT_SUPPORTED_CANNOT_GET_ADVERTISER