cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
537 stars 642 forks source link

Notifications example repo not working #210

Closed arnavvaryani closed 3 years ago

arnavvaryani commented 3 years ago

Remember to specify the plugin name in the title!

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

Describe the bug

Launching lib/main.dart on Redmi 8A in debug mode... lib/main.dart ✓ Built build/app/outputs/flutter-apk/app-debug.apk. Connecting to VM Service at ws://127.0.0.1:57332/gDULpI2sbpE=/ws E/EventChannel#notifications.eventChannel(23247): Failed to open event stream E/EventChannel#notifications.eventChannel(23247): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? E/EventChannel#notifications.eventChannel(23247): at android.app.ContextImpl.startActivity(ContextImpl.java:962) E/EventChannel#notifications.eventChannel(23247): at android.app.ContextImpl.startActivity(ContextImpl.java:938) E/EventChannel#notifications.eventChannel(23247): at android.content.ContextWrapper.startActivity(ContextWrapper.java:393) E/EventChannel#notifications.eventChannel(23247): at dk.cachet.notifications.NotificationsPlugin.onListen(NotificationsPlugin.kt:46) E/EventChannel#notifications.eventChannel(23247): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:188) E/EventChannel#notifications.eventChannel(23247): at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:167) E/EventChannel#notifications.eventChannel(23247): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/EventChannel#notifications.eventChannel(23247): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) E/EventChannel#notifications.eventChannel(23247): at android.os.MessageQueue.nativePollOnce(Native Method) E/EventChannel#notifications.eventChannel(23247): at android.os.MessageQueue.next(MessageQueue.java:336) E/EventChannel#notifications.eventChannel(23247): at android.os.Looper.loop(Looper.java:178) E/EventChannel#notifications.eventChannel(23247): at android.app.ActivityThread.main(ActivityThread.java:7520) E/EventChannel#notifications.eventChannel(23247): at java.lang.reflect.Method.invoke(Native Method) E/EventChannel#notifications.eventChannel(23247): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) E/EventChannel#notifications.eventChannel(23247): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) I/cations_exampl(23247): ProcessProfilingInfo new_methods=476 is saved saved_to_disk=1 resolve_classes_delay=8000

════════ Exception caught by services library ══════════════════════════════════ The following PlatformException was thrown while activating platform stream on channel notifications.eventChannel: PlatformException(error, Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?, null, null)

When the exception was thrown, this was the stack #0 StandardMethodCodec.decodeEnvelope package:flutter/…/services/message_codecs.dart #1 MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart  #2 MethodChannel.invokeMethod package:flutter/…/services/platform_channel.dart #3 EventChannel.receiveBroadcastStream. package:flutter/…/services/platform_channel.dart ... ════════════════════════════════════════════════════════════════════════════════

To Reproduce

The repo doesn't work in the example repo itself, run the example repo.

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 1.22.1, on macOS 11.0 20A5395g, locale en-GB)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1) [!] Android Studio (version 4.1) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [✓] VS Code (version 1.50.1) [!] Connected device

! Doctor found issues in 2 categories.

thomasnilsson commented 3 years ago

I am not able to replicate the error, are you using the example app from the master branch?

https://github.com/cph-cachet/flutter-plugins/tree/master/packages/notifications

arnavvaryani commented 3 years ago

Yes

thomasnilsson commented 3 years ago

I managed to replicate the error on an old android device, will keep you updated.

arnavvaryani commented 3 years ago

Ok great thanks

thomasnilsson commented 3 years ago

Solved in version 1.0.2+1