create Advertise Settings for bluetooth - Android Bluetooth

Android examples for Bluetooth:Bluetooth Address

Description

create Advertise Settings for bluetooth

Demo Code


//package com.book2s;

import android.bluetooth.le.AdvertiseSettings;

public class Main {
    public static AdvertiseSettings createAdvSettings(boolean connectable,
            int timeoutMillis) {
        AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder();
        builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED);
        builder.setConnectable(connectable);
        builder.setTimeout(timeoutMillis);
        builder.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH);
        return builder.build();
    }//from w ww.ja  v  a  2s.  c  o m
}

Related Tutorials