@capgo/capacitor-ボリュームボタンを使用
Capacitor ボリュームボタン プラグイン (ハードウェア ボリューム ボタン押下検出用)
インストール
bun add @capgo/capacitor-volume-buttons
bunx cap sync
このプラグインが公開するもの
addListener- ハードウェア ボリューム ボタン押下を検出するremoveAllListeners- このプラグインのすべてのリスナーを削除するgetPluginVersion- ネイティブ Capacitor プラグインのバージョンを取得する
使用例
addListener
ハードウェア ボリューム ボタン押下を検出する
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const listener = await VolumeButtons.addListener(
'volumeButtonPressed',
(event) => {
console.log(`Volume ${event.direction} button pressed`);
}
);
// Remove listener when done
await listener.remove();
removeAllListeners
このプラグインのすべてのリスナーを削除する
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();
getPluginVersion
ネイティブ Capacitor プラグインのバージョンを取得する
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();
console.log('Plugin version:', version);
全体リファレンス
- GitHub: https://github.com/Cap-go/capacitor-volume-buttons/
- ドキュメント: /docs/plugins/volume-buttons/
Using @capgo/capacitor-volume-buttonsから続けてください
あなたが使用している Using @capgo/capacitor-volume-buttons native プラグインの作業を計画する場合、@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-volume-buttonsを接続してください @capgo/capacitor-volume-buttonsの実装詳細 for the implementation detail in @capgo/capacitor-volume-buttons, Getting Startedの実装詳細 __CAPGO_KEEP_0__ Capacitor Capgo Plugin Directory Capgo製品ワークフロー向けのCapgoプラグインディレクトリ Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and プラグインの追加または更新 プラグインの実装詳細