MoYoung Ble Plugin

1 Introduction

Welcome to use this plugin. This is a Flutter plugin for communicating with the watch.

1.1Platform Support

Android iOS
✔️ ✔️

1.2 Usage

To use this plugin, add moyoung_bluetooth_plugin as a dependency in your pubspec.yaml file.

moyoung_bluetooth_plugin: ^latestVersion

1.3 Project configuration

  • Android

1.Perform the following configuration when generating apk for code obfuscation. Please add the following configuration to your file.

-keep class com.crrepa.ble.** { *; }
-keep class com.example.moyoung_bluetooth_plugin.** { *; }

2.In your App Module, modify the following configuration.

android {
    defaultConfig {
        minSdkVersion 18
  • IOS

1.You need to add it to the info.plist .

<string>Use the location to sync weather from your phone to your watch.</string>
<string>Use the Bluetooth to connect to your Nokia Watch</string>
<string>Use the calendar to sync events from your phone to your watch.</string>
<string>Use the camera to scan the QR code on your watch screen.</string>
<string>The selected contacts will be added to your Watch contacts.</string>
<string>Use the Photo to change your watch face.</string>

2.Use terminal, in your path for project,use pod install to import the library.

1.4 Example

  • First setp

    Import package.

    import 'package:moyoung_bluetooth_plugin/moyoung_ble.dart';
  • Second step

    Apply for some permissions: location, storage.

    • Tip1: You need to apply for these permissions yourself

    • Tip2: Of course you can use the example in the Example project to apply for permissions. But, please note the configuration of permissions in this file:AndroidManifest.xml

  • Third step

    Use in pages.

    class _MyAppState extends State<MyApp> {
      final _streamSubscriptions = <StreamSubscription<dynamic>>[];
      final MoYoungBle _blePlugin = MoYoungBle();
      final List<BleScanBean> _deviceList = [];
      void initState() {
      void subscriptStream() {
            (BleScanBean event) async {
              setState(() {
                if (event.isCompleted) {
                  //Scan completed, do something
                } else {
      void dispose() {
        for (final subscription in _streamSubscriptions) {
      // Scanning bluetooth devices
      void startScan() {
        if (!mounted) return;
        _blePlugin.startScan(10*1000).then((value) => {
          setState(() {
            // Do something.
            print(value ? "Scanning" : "Have not started");
        }).onError((error, stackTrace) => {
          //Usually some permissions are not requested

1.5 Detailed usage document

Click to Wiki.

1.6 Full sample project

The Example project contains details about how the code is used.

Click to Example.


Click to License.