0
我需要讓用戶啓用藍牙,但我不想使用每個平臺的本地方法,NativeScript中是否存在標準化的方法?如何讓用戶在NativeScript上啓用藍牙而不使用本機代碼
對於這種類型的請求應該使用哪些類,以便代碼與iOS和Android平臺兼容,或者它們可能提供什麼?
我需要這樣的iOS和Android代碼:
DemoAppModel.prototype.doEnableBluetooth = function() {
bluetooth.enable().then(function(enabled) {
if(!enabled)
setTimeout(function() {
/* I need this code for iOS and Android */
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}, 500);
});
};
嗨@ Eddy-Verbruggen,冷杉所有的插件感謝,非常好,但不適用於藍牙經典。 我更新了問題。 – Delfino