Code Monkey home page Code Monkey logo

flt_worker's People

Contributors

xinthink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flt_worker's Issues

Does the example works?

I cloned the repo and started the example on ios simulator. Apparently nothing happened when I click the buttons, no error, no exceptions, no value being changed.

[✓] Flutter (Channel master, 1.22.0-10.0.pre.380, on Mac OS X 10.15.6 19G2021 x86_64, locale en-BR)
    • Flutter version 1.22.0-10.0.pre.380 at /Users/vicente/fvm/versions/master
    • Framework revision ec40df9576 (11 hours ago), 2020-09-25 21:27:22 -0700
    • Engine revision 3a73d073c8
    • Dart version 2.11.0 (build 2.11.0-161.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/vicente/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • ANDROID_SDK_ROOT = /Users/vicente/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.9.3

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.1.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.49.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.14.1


[✓] Connected device (1 available)
    • iPhone SE (2nd generation) (mobile) • 20FE9D1E-FFAB-4B29-807E-BDDB6794DE71 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)

• No issues found!

What should I do for iOS < 13?

Hello,

Thank you for the amazing plugin! I'm thinking about using it in my app to upload data to a server. There is a "background upload" plugin but I need to use client SSL certificates that this other plugin can't handle so a combination of your plugin and dio might save me.

I still want to be able to install my app on iOS < 13, in which case it's fine if the upload doesn't happen in a background task.

Is there a way to do this with you plugin? Or maybe just disable it for platforms < 13?

Thanks for the help! I'm still new to flutter, sorry if that's a dumb question

Register plugin from isolate

If I want to use another plugin that starts in isolate and auto register plugins(like foreground service), there is an issue.
The problem is that flt_worker requires an activity and crashes on registration, which leads to registering only the plugins that was before it in the GeneratedPluginRegistrant
The problem is here :

          final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
          channel.setMethodCallHandler(new FltWorkerPlugin(registrar.activity()));

I have changed it manually on my side to :

    try {
          final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
          channel.setMethodCallHandler(new FltWorkerPlugin(registrar.activity()));
      } catch (Exception e) {
          Log.e("Error","FltWorkerPlugin.registerWith", e );
      }

And now can see the crash in the logs, but is handled and GeneratedPluginRegistrant can continue with the other plugins. Also I don't use flt_worker from other isolates and above approach is saving me

Btw, I haven't checked if your plugin really needs an activity? If not you can pass a context only. Bellow code does not log a crash when is started from another isolate and also works when I tested it in my app

  public static void registerWith(Registrar registrar) {
      try {
          final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME);
          channel.setMethodCallHandler(new FltWorkerPlugin(registrar.context()));
      } catch (Exception e) {
          Log.e("Error","FltWorkerPlugin.registerWith", e );
      }
  }

I got error when i am run my app


√  Built build\app\outputs\flutter-apk\app-debug.apk.
E/AndroidRuntime(28338): FATAL EXCEPTION: pool-6-thread-1
E/AndroidRuntime(28338): Process: com.astechtic.raksha, PID: 28338
E/AndroidRuntime(28338): java.lang.IllegalArgumentException: com.astechtic.raksha: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(28338): Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
E/AndroidRuntime(28338): 	at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/AndroidRuntime(28338): 	at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
E/AndroidRuntime(28338): 	at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
E/AndroidRuntime(28338): 	at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:196)
E/AndroidRuntime(28338): 	at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:128)
E/AndroidRuntime(28338): 	at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:93)
E/AndroidRuntime(28338): 	at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
E/AndroidRuntime(28338): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(28338): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(28338): 	at java.lang.Thread.run(Thread.java:920)

null-safety

It would be greatly appreciated if we could get a updated null-safe version of the library, I will contribute a pull request with the necessary migrations.

Plugin doesn't work with mainactivity.kt

it appears that the plugin does not work when the flutter app uses a kotlin based main activity.
I followed the example and modified the java code to meet the Kotlin syntax but was met with an error saying that it expected a function in java form, not kotlin.

NetworkType

Hi, thanks for this great plugin!

I'm currently testing the abilities with the example app and I'm noticing something strange with the NetworkTypes.

When I set NetworkType.notRequired , the task is not executing until I enable the WiFi and connect to the router, like is set NetworkType.unmetered.

If I set NetworkType.unmetered , the task is executing even if the WiFi is off and I'm connected on the mobile network only, like should be for NetworkType.connected.

If I set NetworkType.connected, the task is executing even if the WiFi and Mobile data are off, like should be for NetworkType.notRequired.

I'm testing with the example app on Pixel XL 3a - Android 11

/// Enqueues a work request to update the counter.
void _increaseCounter(int counter) {
enqueueWorkIntent(WorkIntent(
identifier: kTagCounterWork,
constraints: WorkConstraints(networkType: NetworkType.connected),
input: <String, dynamic>{
'counter': counter,
},
isProcessingTask: true,
));
}

[√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.19041.985], locale bg-BG)
• Flutter version 1.26.0-1.0.pre at C:\code\soft\flutter_sdk\flutter
• Framework revision 63062a6443 (5 months ago), 2020-12-13 23:19:13 +0800
• Engine revision 4797b06652
• Dart version 2.12.0 (build 2.12.0-141.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:/Users/x/AppData/Local/Android/Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:/Users/x/AppData/Local/Android/Sdk
• Java binary at: C:\code\soft\android-studio-ide-4.1.3\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
• Android Studio at C:\code\soft\android-studio-ide-4.1.3\android-studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (3 available)
• Pixel 3a XL (mobile) • 94DAX0DRW1 • android-arm64 • Android 11 (API 30)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.62

• No issues found!

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.