先写一个Ble服务 AdvertiserService 代码如下
/**
* Created by lxy on 2022/04/26.
*/
public class AdvertiserService extends Service {
// private RecvDelegate delegate;
private static final String TAG="AdvertiserService";
String CHANNEL_ONE_ID = "com.shanling.com";
// private static final int FOREGROUND_NOTIFICATION_ID=1;
public static BluetoothDevice mDevice;
private static final String NOTIF_ID = "com.shanling.bleService"; //这里的id里面输入自己的项目的包的路径
private static final String NOTIF_NAME = "Channel_One";
public static boolean running=false;
public static final String ADVERTISENG_FILED="com.shanLing.Lxy.advertising_failed";
public static final String ADVERTISING_FAILED_EXTRA_CODE="failureCode";
// public static final int ADVERTISING_TIMED_OUT=6;
private BluetoothLeAdvertiser mBluetoothLeAdvertiser;
private Adverti
|