微信小程序BLE蓝牙通信 兼容Android、IOS
关键点:
1、服务ID:

var platform = app.globalData.platform    //ios 平台 服务id 中字母必须为大写    if (platform == "ios") {      return this.data.serviceId.toUpperCase();    }    //android 平台 服务id 中字母必须为小写    else if (platform == "android") {      return this.data.serviceId.toLowerCase();    }    else {      return this.data.serviceId    }

2、  发送/获取发送id

 getSendId: function () {    var platform = app.globalData.platform    //ios 平台 服务id 中字母必须为大写    if (platform == "ios") {      return this.data.sendId.toUpperCase();      }    //android 平台 服务id 中字母必须为小写    else if (platform == "android") {      return this.data.sendId.toLowerCase();      }    else {      return this.data.sendId      }    },

3、通知ID
//通知id
getReceiveId: function () {

var platform = app.globalData.platform//ios 平台 服务id 中字母必须为大写if (platform == "ios") {  return this.data.receiveId.toUpperCase();}//android 平台 服务id 中字母必须为小写else if (platform == "android") {  return this.data.receiveId.toLowerCase();}else {  return this.data.receiveId}

}

TAG标签: 微信小程序蓝牙广播

http://www.xiaochengxub.com/read-105378.html