パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.1.7

bluetooth_enable_fork

アプリ内でBluetoothを有効にするためのFlutterプラグイン

AndroidiOS
30日間ダウンロード
967
いいね数
20
Pub ポイント
140

パッケージをインストール

flutter pub add bluetooth_enable_fork

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

AndroidおよびiOSのアプリ内で直接Bluetoothを有効にするためのFlutterプラグインです。Bluetoothの状態を確認し、アクティベーションをリクエストする簡単なインターフェースを提供しており、必要に応じてユーザーがBluetoothを有効にするよう案内できます。元のbluetooth_enableパッケージのフォークとして設計されており、互換性を維持しつつ、改善点や修正を提供しています。ビーコン、IoTデバイス、またはNFCベースのサービスなど、Bluetooth接続に依存するアプリケーションに最適です。

用途

  • IoTアプリでBluetoothを有効にする
  • ユーザーにBluetoothをオンにする方法を案内する
  • ビーコン検出との統合
  • NFCおよび近接機能をサポート
  • アプリでのBluetooth権限の取り扱い

主な機能

  • クロスプラットフォーム対応(Android および iOS)
  • Bluetoothの確認および有効化用の簡単なAPI
  • ユーザーに優しい権限の取り扱い
  • 潜在的なバグ修正付きのフォーク
  • 軽量で統合が簡単

適している対象

  • Bluetoothに依存するアプリを開発している開発者
  • ユーザーによるガイド付きBluetooth設定を必要とするアプリ
  • IoTおよびビーコンベースのソリューション
  • 信頼性のあるBluetooth状態管理を必要とするモバイルアプリ
  • 元の bluetooth_enable パッケージを使用しているプロジェクト

注意事項

  • Bluetoothを有効にするにはユーザーの操作が必要です
  • 基本的なBluetooth状態制御に限定
  • 一部のプラットフォームでは追加の権限が必要になる場合があります
  • 下位OSのBluetooth実装に依存します
  • バックグラウンドBluetooth操作には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Introduction

BluetoothEnable is a Bluetooth plugin for Flutter, to programtically request turning on Bluetooth within applications.

This plugin was created with the intention to allow developers to customise their own application workflow on when permissions are requested.

Usage

Enable Bluetooth
import 'package:bluetooth_enable_fork/bluetooth_enable.dart';

// Request to turn on Bluetooth within an app
BluetoothEnable.enableBluetooth.then((result) {
  if (result == "true") {
    // Bluetooth has been enabled
  }
  else if (result == "false") {
    // Bluetooth has not been enabled
  }
});
Enable Bluetooth with Custom Alert

This method calls an alert from Dart level. Depending on the user's selection, Bluetooth will either be manually turned on without an additional dialog request or nothing happens.

Parameter Description
context The material context of your current content
dialogTitle The title of the dialog is displayed in a large font at the top
displayDialogContent Enable or disable showing dialog content
dialogContent The content of the dialog that is displayed in the center
cancelBtnText The cancel button text of the dialog (left button)
acceptBtnText The accept button text of the dialog (right button)
dialogRadius The border radius of dialog
barrierDismissible Enable or Disable whether dialog is dismissible on external click
import  'package:bluetooth_enable_fork/bluetooth_enable.dart';

Future<void> customEnableBT(BuildContext context) async {
  String dialogTitle = "Hey! Please give me permission to use Bluetooth!";
  bool displayDialogContent = true;
  String dialogContent = "This app requires Bluetooth to connect to device.";
  //or
  // bool displayDialogContent = false;
  // String dialogContent = "";
  String cancelBtnText = "Nope";
  String acceptBtnText = "Sure";
  double dialogRadius = 10.0;
  bool barrierDismissible = true; //

  BluetoothEnable.customBluetoothRequest(context, dialogTitle, displayDialogContent, dialogContent, cancelBtnText, acceptBtnText, dialogRadius, barrierDismissible).then((result) {
    if (result == "true") {
      //Bluetooth has been enabled
    }
  });
}
iOS support

If Bluetooth has not been activated, a popup window will appear on enableBluetooth call asking user to activate Bluetooth in the application settings; the method will immediately return false (but will return true on next call if user enabled Bluetooth in the meantime).

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。