Closed rehamalraee closed 3 years ago
Hi @rehamalraee
Could you please provide your flutter doctor -v
, and flutter pub deps -- --style=compact
?
Thank you
@markusaksli-nc hello
Dart SDK 2.10.4
Flutter SDK 1.22.5
vrbt 1.0.0+1
dependencies:
- android_alarm_manager 0.4.5+17 [flutter]
- cached_network_image 2.5.0 [flutter flutter_cache_manager octo_image]
- call_log 2.1.0 [flutter]
- carousel_slider 2.3.1 [flutter]
- contacts_service 0.4.6 [flutter collection quiver]
- convex_bottom_bar 2.6.0 [flutter]
- country_code_picker 1.7.0 [flutter modal_bottom_sheet]
- cupertino_icons 1.0.0
- delayed_display 1.1.0 [flutter]
- dio 3.0.10 [http_parser path]
- firebase_core 0.5.3 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_messaging 7.0.3 [meta flutter firebase_core]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_downloader 1.5.2 [flutter]
- flutter_phoenix 0.1.0 [flutter]
- flutter_phone_direct_caller 1.0.1 [flutter]
- flutter_spinkit 4.1.2+1 [flutter]
- fluttercontactpicker 4.2.1 [flutter contact_picker_platform_interface contact_picker_web]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image_picker 0.6.7+17 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- intl 0.16.1 [path]
- intl_phone_number_input 0.6.0 [flutter meta libphonenumber libphonenumber_plugin equatable]
- libphonenumber 1.0.2 [flutter meta]
- loader_overlay 1.1.1 [flutter]
- numeric_keyboard 1.0.0 [flutter]
- path_provider 1.6.24 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface]
- screen 0.0.5 [flutter]
- shared_preferences 0.5.12+4 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_p
references_windows]
- sim_info 0.1.3 [flutter]
- splashscreen 1.3.5 [flutter]
- thumbnails 1.0.1 [flutter]
- unicorndial 1.1.5 [flutter]
- url_launcher 5.7.10 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows]
- video_player 1.0.1 [meta video_player_platform_interface video_player_web flutter]
- video_thumbnail 0.2.5+1 [flutter]
dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span
stream_channel string_scanner term_glyph typed_data]
transitive dependencies:
- archive 2.0.13 [crypto args path]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- collection 1.15.0-nullsafety.3
- contact_picker_platform_interface 4.2.0 [flutter meta plugin_platform_interface]
- contact_picker_web 4.2.1 [flutter flutter_web_plugins js contact_picker_platform_interface]
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- equatable 1.2.5 [collection meta]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase_core_platform_interface 2.1.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+1 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_blurhash 0.5.0 [flutter meta]
- flutter_cache_manager 2.1.0 [flutter path_provider uuid http path sqflite pedantic clock file rxdart image]
- flutter_plugin_android_lifecycle 1.0.11 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- image 2.1.19 [archive xml meta]
- image_picker_platform_interface 1.1.1 [flutter meta http plugin_platform_interface]
- js 0.6.2
- libphonenumber_platform_interface 0.2.0 [flutter plugin_platform_interface]
- libphonenumber_plugin 0.1.0 [flutter flutter_web_plugins libphonenumber_platform_interface libphonenumber_web]
- libphonenumber_web 0.1.1 [flutter flutter_web_plugins js libphonenumber_platform_interface]
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- modal_bottom_sheet 1.0.1-dev [flutter]
- octo_image 0.3.0 [flutter flutter_blurhash]
- path 1.8.0-nullsafety.1
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+6 [flutter]
- path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- petitparser 3.1.0 [meta]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- process 3.0.13 [file intl meta path platform]
- quiver 2.1.5 [matcher meta]
- rxdart 0.24.1
- shared_preferences_linux 0.0.2+4 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+11 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+3 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sqflite 1.3.2+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_linux 0.0.1+4 [flutter]
- url_launcher_macos 0.0.1+9 [flutter]
- url_launcher_platform_interface 1.0.9 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.5+1 [url_launcher_platform_interface flutter flutter_web_plugins meta]
- url_launcher_windows 0.0.1+3 [flutter]
- uuid 2.2.2 [crypto convert]
- vector_math 2.1.0-nullsafety.3
- video_player_platform_interface 2.2.0 [flutter meta]
- video_player_web 0.1.4+1 [flutter flutter_web_plugins meta video_player_platform_interface]
- win32 1.7.3 [ffi]
- xdg_directories 0.1.2 [meta path process]
- xml 4.5.1 [collection convert meta petitparser]
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19041.685], locale en-US)
• Flutter version 1.22.5 at C:\Users\ThinkPad\Downloads\flutter
• Framework revision 7891006299 (4 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\ThinkPad\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:\Users\ThinkPad\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (2 available)
• CPH1821 (mobile) • O7VCSCWSIRJZEED6 • android-arm64 • Android 10 (API 29)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
! Doctor found issues in 1 category.
Could you try migrating to the new firebase_messaging: ^8.0.0-dev.11
version?
The update got rid of the old background messaging handler workaround and is more stable in general.
@markusaksli-nc Hello, Is this update affects the background handler behavior? the usage of firebase_messaging: ^8.0.0-dev.11 is different from firebase_messaging: ^7.0.3.
Yes the update affects the background handler, and the entire plugin in general. The version you are using will be replaced soon and even if the problem is with 7.0.3
the development effort is focused on the rework.
There is an official example for the new version and a list of breaking changes. You can also take a look at the migration page https://firebase.flutter.dev/docs/migration#messaging.
@markusaksli-nc Hello, Are you know why the FCM is not received when my app foreground service is killed, to be more clear I'm trying to keep my app always running in the background and I used the foreground services to achieve this, sometimes the app not killed by the ANDROID system and the foreground notification appears for more than 15 hours, But other times it killed after 1 hour or less or 2hours and less when my foreground notification is killed and I send FCM notification it didn't receive by my device!! what is the problem here! how can I solve it!
Like I said, could you try updating to the new version as it is a lot more stable in general.
There is an official example of how to use it at https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_messaging/firebase_messaging/example/lib
Without a specific minimal complete reproducible code sample it is very hard to tell what could be wrong and as I said, the version you are using will be completely replaced and deprecated soon.
Hi @markusaksli-nc ! Unfortunatelly I have all the recent versions of firebase_messaging an core and flutter and everything but I am still getiing an error:
Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@7d7493b) but could not find and invoke the GeneratedPluginRegistrant.
And it only happens when I add onBackgroundMessage method, without it notifications and everything is working great. But I need to save some data from notification to sharedpreferences but this is just not working, I have spend the whole day today researching and trying different solutions on the internet but nothing works...
Also I am getting those while building I don't know if it should be this way or is it related to the problem:
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-8.0.0-dev.14\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java uses or overrides a deprecated API.
hello @davidcz95 u have to use this FirebaseMessagingPlugin.registerWith(registry!!.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) in ur registerWith function
@rehamalraee Thank you for your answer but I have automatically generated "GeneratedPluginRegistrant" as it should be according to the newest documentation my MainActivity is mostly empty So I dont think I can solve it this Way... Or should I manulaly add this line to the mainactivity?
@davidcz95 yes try this.
@rehamalraee Well I can't quite figure this out this is all I have in my MainActivity could you provide me with some tips of how to incorporate your solution?
public class MainActivity extends FlutterActivity {}
@davidcz95 check for these
<meta-data
android:name="flutterEmbedding"
android:value="2" />
in your android manifest, And I'll provide u with the code.
@davidcz95 check this solution,
@rehamalraee yes I have it in my AndroidManifest as I said I have all the udpated and newest versions of the plugins and I followed every point in the migration guide
@rehamalraee ok so I used this solution created new kt file and paste there the code also I have change in the manifest android:name to point into it but I am getting this errors now:
e: D:\AndroidStudioProjects\mobilgo\android\app\src\main\java\io\flutter\plugins\Application.kt: (5, 27): Unresolved reference: firebasemessaging
e: D:\AndroidStudioProjects\mobilgo\android\app\src\main\java\io\flutter\plugins\Application.kt: (12, 9): Unresolved reference: FlutterFirebaseMessagingService
e: D:\AndroidStudioProjects\mobilgo\android\app\src\main\java\io\flutter\plugins\Application.kt: (16, 9): Unresolved reference: FirebaseCloudMessagingPluginRegistrant
And I think this is because the newest docs says that we don't need to change native code to register those plugins any more but it just don't work so I think devs just needs to fix it as the new version is just not working at all and I think I will have to downgrade to 7.0.5 from the newest 8.0.0-dev.14 until someone fix it...
@davidcz95 Have you tried running flutter clean after upgrading to lates 8.0.0-dev.14 and following the migration guide. It fixed every issues for me.
Yes I did I even did pub cache repair twice and after that I have even created a New project and copy all the files there and still got the same error. Everything is working great until i try to invoke onBackground method...
@davidcz95 Do you still have the Application.java hack for background message handling with the old version? If so you need to remove it.
@rehamalraee What is the status here? Have you been able to solve the issue for yourself?
@markusaksli-nc Hey, No, as I said I have empty MainActivity and followed all tips in migration guide also I have all the newest plugins, but the problem still persist..
I really can't solve it. Do you need any more information? This is my AndroidManifest:
`<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="EXAMPLE">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label=EXAMPLE"
android:icon="@mipmap/launcher_icon">
<activity
android:name="io.flutter.plugins.MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="EXAMPLE"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="high_importance_channel" />
</application>
`
@markusaksli-nc hi, Not yet, Still I'm waiting for the response for this firebase core issue if this will solve it also or not.
@markusaksli-nc I see you changed it to deprecated-version, but I have the newest, should I create a new issue?
Since it is the same error log I don't think that will be necessary.
Also I removed the deprecated version label because this seems to be for the latest version for both of you.
Update: The WARNING still appears after updating to the new version, BUT it didn't affect the functionality or stop the app as before, so I'm going to close this and wait for the new release documentation if this will be solved or not.
Closing this for now since it is just a warning and it seems like a rare one at that.
@markusaksli-nc Hello, Is there a way to know when the DART executor finish? I search a lot but there is no helpful resource, please if u can help I'll appreciate ur kindness. I want to know when the flutter background code finish the work to destroy the flutter engine since I'll call the function on each phone call
I'm not sure, you could always ask in the community https://stackoverflow.com/tags/flutter https://www.reddit.com/r/FlutterDev/.
Bug report
Tried to automatically register plugins with FlutterEngine (io.flutter.embedding.engine.FlutterEngine@7d7493b) but could not find and invoke the GeneratedPluginRegistran I have FCM configuration in my app, and its working fine until I invoke my background handler in the app background running state, I got that
but when I tried to register manually using
flutterEngine?.getPlugins()?.add(FirebaseMessagingPlugin())
I got that the FCM already registered with this engine, ## then the notifications never been received
this is how I call my Background handler: