GithubHelp home page GithubHelp logo

[Issue]: Missing Plugin exception when the app is in background. Using home screen widget to start the scan about flutter_blue_plus HOT 9 CLOSED

rohanots avatar rohanots commented on June 30, 2024
[Issue]: Missing Plugin exception when the app is in background. Using home screen widget to start the scan

from flutter_blue_plus.

Comments (9)

chipweinberger avatar chipweinberger commented on June 30, 2024 2

flutterHotRestart is called during any fbp launch, not just hot restart.

edit: just now, in this commit (29561d5) i renamed it to flutterRestart

from flutter_blue_plus.

chipweinberger avatar chipweinberger commented on June 30, 2024

did you look here: https://github.com/boskokg/flutter_blue_plus?tab=readme-ov-file#missingpluginexceptionno-implementation-found-for-method-xxxx-


MissingPluginException(No implementation found for method XXXX ...)

If you just added flutter_blue_plus to your pubspec.yaml, a hot reload / hot restart is not enough.

You need to fully stop your app and run again so that the native plugins are loaded.

Also try flutter clean.

from flutter_blue_plus.

rohanots avatar rohanots commented on June 30, 2024

Yes Sir, I did. Actually, this is happening because the invoke method is unable to perform a hot restart since the app is is in background.

Why my app is in background?
Because I am using home screen widget flutter and starting the BLE scan from there.

Log:
MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)
No implementation found for method flutterHotRestart

from flutter_blue_plus.

rohanots avatar rohanots commented on June 30, 2024

Is there any way we can scan and connect nearby BLE devices with iOS devices while the app is in background.

from flutter_blue_plus.

chipweinberger avatar chipweinberger commented on June 30, 2024

yes. implement this PR: #846

pauldemarco/flutter_blue#210

from flutter_blue_plus.

chipweinberger avatar chipweinberger commented on June 30, 2024

I cannot reproduce this problem btw. Starting from home screen works for me.

from flutter_blue_plus.

rohanots avatar rohanots commented on June 30, 2024

This is how I am doing this. The app is background/killed. A user can quickly connect with BT device from the widget outside without opening the app.

image

Using the home_widget package.
Code on button clicks.
@pragma('vm:entry-point') Future<void> interactiveCallback(Uri? uri) async { // Set AppGroup Id. This is needed for iOS Apps to talk to their WidgetExtensions await HomeWidget.setAppGroupId(Constants.appGroupId); print("interactiveCallback ${uri?.host}"); // We check the host of the uri to determine which action should be triggered. if (uri?.host == 'increment') { await connectBTDevice(); } else if (uri?.host == 'unlock') { await unlockDevice(); } }

`connectBTDevice(){
FlutterBluePlus.startScan(
timeout: const Duration(seconds: 3),
);

 for (var btDevice in scanResults) {
          if (btDevice.advertisementData.advName.split('-').last ==
              tempDeviceId) {
              await btDevice.connect();
  }       

}
`

from flutter_blue_plus.

chipweinberger avatar chipweinberger commented on June 30, 2024

Ah, I did not understand what you meant by Home Screen Widget. Thank you for the screenshot.

This is not something I know how to fix. Sorry. If you fix it, please open PR.

My guess is that the problem must be fixed in the home_widget package, not fbp

from flutter_blue_plus.

rohanots avatar rohanots commented on June 30, 2024

No i have not been able to fix this yet.
Thanks for your replies and the quick support.

from flutter_blue_plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.