前提・実現したいこと
前提: 1. api liff.init、liff.scanCodeV2などはweb で正常に実行できる。 2. ガイドランより、message channelは作成しました、かつ、line things api(curl -X GET xxx, curl -X put xxx など)は正常。
実現したいこと: web appでbluetooth api(liff.initPlugins(["bluetooth"]), liff.bluetooth.getAvailability()など)を使いたい。
発生している問題・エラーメッセージ
web appでbluetooth api liff.initPlugins(["bluetooth"])を使うと、「error forbidden plugin 'bluetooth' is not supported, Bluetooth only works in LINE client. "BLE feature" must also be enabled in Developer Center.」とのエラーメッセージを表示してしまった。
該当のソースコード
- sdk導入:<script charset="utf-8" src="https://static.line-scdn.net/liff/edge/2/sdk.js"></script>
- web ソース:
<script> /*globals liff */ export default { name: 'App', data: () => ({ userId: null, name: null, picture: null, tid: null, bluetoothflg: null, }), methods: { // 画面でbluetoothテストボタンイベント bluetoothTest: function() { // エラー発生「error forbidden plugin 'bluetooth' is not supported, Bluetooth only works in LINE client. "BLE feature" must also be enabled in Developer Center.」 liff .initPlugins(["bluetooth"]) .then(() => { this.bluetoothflg = "bluetooth ok"; }) .catch((error) => { this.bluetoothflg = error; }); // scanCodeV2は正常できる liff .scanCodeV2() .then(() => { // result = { value: "" } }) .catch((error) => { console.log("error", error); }); } }, // 画面初期化 created : function() { // 正常 liff .init({ liffId: '1657431183-xxx' }) .then(() => { // start to use LIFF's api // initializeApp(); // 正常 liff.getProfile().then(profile => { this.userId = profile.userId this.name = profile.displayName this.picture = profile.pictureUrl this.tid = this.$route.query.tid; }); }) .catch((err) => { console.log('LIFF initialization failed', err) }); }, }; </script>
bluetooth apiを使い場合、何か特別の設定は必要がありますか、 上記のbluetooth apiの使い方は問題がありますか、教えていただけませんか。
Similar posts
No similar posts