Git Product home page Git Product logo

fcm_config's Introduction

fcm_config's People

Contributors

maxzod avatar mo-ah-dawood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fcm_config's Issues

not working in iOS

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4.1 22F82 darwin-x64, locale en-EG)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

this is my code :
WidgetsFlutterBinding.ensureInitialized();
//await FCMConfig.instance.getInitialMessage();
await FCMConfig.instance.init(
alert: true,
announcement: true,
badge: true,
displayInForeground: (_) => true,
carPlay: false,
criticalAlert: true,
options: DefaultFirebaseOptions.currentPlatform,
onBackgroundMessage: _firebaseMessagingBackgroundHandler,
defaultAndroidChannel:
AndroidNotificationChannel('high_importance_channel', 'sunahouse'));

FCMConfig.instance.messaging.getToken().then((token) async {
print(token);
});

Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
print("Handling a background message: ${message.messageId}");
}

fcm_config: ^3.5.2

FormatException in getInitialMessage

Future<void> _checkOnReceivedNotification() async {
    final initialMessage = await FCMConfig.instance.getInitialMessage();
    if (initialMessage != null) {
      onPushNotificationTap?.call(initialMessage);
    }
  }

image

It works fine when the app is open, but when I open it from the notification, it throws an error.
Example of the PN:

{senderId: null, category: null, collapseKey: null, contentAvailable: false, data: {twi_message_id: RUb5c43c3edb424986c02256d936eff86f, twi_body: {"message":{"sender_id":4170,"text":"Alex2 K, Alex Kalashnikov\n123\n ","type":"chat_message","chat_room_id":23517},"sound":1}}, from: 281770282794, messageId: 0:1659539439408925%aa724556f9fd7ecd, messageType: null, mutableContent: false, notification: null, sentTime: 1659539439369, threadId: null, ttl: 2419200}

PS: The service that sends these messages is Twilio.

[HELP] Change web notification icon

I didn't find anything in the documentation, and looking at the code it doesn't seem to be implemented, but I'd like to confirm this/request the feature

firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Method not found: 'Error.throwWithStackTrace'.

firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/Users/TEBALINK/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/Users/TEBALINK/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 29s
Exception: Gradle task assembleDebug failed with exit code 1

E/flutter (19269): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)

environment:
sdk: '>=2.19.6 <3.0.0'

fcm_config: ^3.5.1

E/flutter (19269): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null)
E/flutter (19269): #0 FirebaseCoreHostApi.optionsFromResource (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:248:7)
E/flutter (19269):
E/flutter (19269): #1 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:89:25)
E/flutter (19269):
E/flutter (19269): #2 Firebase.initializeApp (package:firebase_core/src/firebase.dart:43:31)
E/flutter (19269):
E/flutter (19269): #3 FCMConfig.init (package:fcm_config/src/fcm_config.dart:109:5)
E/flutter (19269):
E/flutter (19269): #4 main (package:ecommerce_2368/main.dart:34:3)

I upgrade to version 3.2.2 and I have an issue

I have this issue

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(INVALID_ICON, The resource could not be found. Please make sure it has been added as a drawable resource to your Android head project., null, null)

I tried to change the icon meta data like :

making the the ic_launcher in this destination "android/app/src/main/res/drawable" but it doesn't work too

image

Outdated FlutterFirebaseMessagingPlugin.java

Since I upgraded to the Null Safety environment sdk: ">=2.12.0 <3.0.0" in pubspec.yaml I started getting the following errors in Android Studio when I try to build my app;

C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:20: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceId;
                              ^
  symbol:   class FirebaseInstanceId
  location: package com.google.firebase.iid
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:21: error: cannot find symbol
import com.google.firebase.iid.Metadata;
                              ^
  symbol:   class Metadata
  location: package com.google.firebase.iid
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:152: error: cannot find symbol
                  : Metadata.getDefaultSenderId(FirebaseApp.getInstance());
                    ^
  symbol:   variable Metadata
  location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:153: error: cannot find symbol
          FirebaseInstanceId.getInstance().deleteToken(senderId, "*");
          ^
  symbol:   variable FirebaseInstanceId
  location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:165: error: cannot find symbol
                  : Metadata.getDefaultSenderId(FirebaseApp.getInstance());
                    ^
  symbol:   variable Metadata
  location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:166: error: cannot find symbol
          String token = FirebaseInstanceId.getInstance().getToken(senderId, "*");
                         ^
  symbol:   variable FirebaseInstanceId
  location: class FlutterFirebaseMessagingPlugin
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_messaging:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

don't user web i need use fcm config web

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/Metadata;

FATAL EXCEPTION: pool-13-thread-1
E/AndroidRuntime(18427): Process: com.jadeeer.jadeeer, PID: 18427
E/AndroidRuntime(18427): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/Metadata;
E/AndroidRuntime(18427): at io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingPlugin.lambda$getToken$1$FlutterFirebaseMessagingPlugin(FlutterFirebaseMessagingPlugin.java:165)
E/AndroidRuntime(18427): at io.flutter.plugins.firebase.messaging.-$$Lambda$FlutterFirebaseMessagingPlugin$CIEVVSZZupyLaxqSu4HKcRkuppw.call(Unknown Source:4)
E/AndroidRuntime(18427): at com.google.android.gms.tasks.zzv.run(Unknown Source:2)
E/AndroidRuntime(18427): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
E/AndroidRuntime(18427): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
E/AndroidRuntime(18427): at java.lang.Thread.run(Thread.java:764)
E/AndroidRuntime(18427): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.Metadata" on path: DexPathList[[zip file "/data/app/com.jadeeer.jadeeer-SWNDrR58NKAkGfScmYQO7g==/base.apk"],nativeLibraryDirectories=[/data/app/com.jadeeer.jadeeer-SWNDrR58NKAkGfScmYQO7g==/lib/arm, /data/app/com.jadeeer.jadeeer-SWNDrR58NKAkGfScmYQO7g==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
E/AndroidRuntime(18427): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
E/AndroidRuntime(18427): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(18427): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

Creating background FlutterEngine instance, with args: [--start-paused, --enable-dart-profiling]

Creating background FlutterEngine instance, with args: [--start-paused, --enable-dart-profiling]
E/flutter (28064): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Bad state: Cannot add new events while doing an addStream
E/flutter (28064): #0 _BroadcastStreamController.addStream (dart:async/broadcast_stream_controller.dart:276:24)
E/flutter (28064): #1 Stream.pipe (dart:async/stream.dart:698:27)
E/flutter (28064): #2 FirebaseMessaging._onMessageController. (package:firebase_messaging/src/messaging.dart:60:21)
E/flutter (28064): #3 _runGuarded (dart:async/stream_controller.dart:773:24)
E/flutter (28064): #4 _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:207:7)
E/flutter (28064): #5 _ControllerStream._createSubscription (dart:async/stream_controller.dart:786:19)
E/flutter (28064): #6 _StreamImpl.listen (dart:async/stream_impl.dart:473:9)
E/flutter (28064): #7 LocaleNotification.init (package:fcm_config/src/locale_notifications.dart:50:51)
E/flutter (28064):
E/flutter (28064):

Prevent using local notification plugin to change the sound of notification

There is a parameter in the displayNotification method to control the sound of notification. It requires the flutter_local_notification plugin inside our project to change it.
It's not cool to use both plugins because we are using this plugin to facilitate the implementation and, also, it made a lot of dependency incompatibility.
Could you use a boolean param instead of this object to handle the sound of notification?

../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'. FirebaseAppPlatform.verifyExtends(_delegate);

Running Gradle task 'assembleDebug'...
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'.
FirebaseAppPlatform.verifyExtends(_delegate);

/Users/tebalink/development/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.6 21G115 darwin-arm (Rosetta), locale en-EG)
• Flutter version 3.0.0 at /Users/tebalink/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (6 months ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
• Android SDK at /Users/tebalink/Library/Android/sdk
• Platform android-33, build-tools 33.0.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 69.0.5
• Dart plugin version 222.3345.108

[✓] Connected device (2 available)
• SM G610F (mobile) • 5203fd5afa51b33f • android-arm • Android 8.1.0 (API 27)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm (Rosetta)
! Error: sayed is not connected. Xcode will continue when sayed is connected and unlocked. (code -13)

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 1 category.
Process finished with exit code 0

onClick not working and throwing many errors

I can successfully get a local notification to show when a message comes in, but when I click on the notification in order to return back to the app, the onClick doesn't fire and I get all these errors:

E/flutter (18982): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormatException: Unexpected end of input (at character 1)
E/flutter (18982): 
E/flutter (18982): ^
E/flutter (18982): 
E/flutter (18982): #0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1405:5)
E/flutter (18982): #1      _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:523:7)
E/flutter (18982): #2      _parseJson (dart:convert-patch/convert_patch.dart:41:10)
E/flutter (18982): #3      JsonDecoder.convert (dart:convert/json.dart:506:36)
E/flutter (18982): #4      JsonCodec.decode (dart:convert/json.dart:157:41)
E/flutter (18982): #5      jsonDecode (dart:convert/json.dart:96:10)
E/flutter (18982): #6      NotificationManager._onPayLoad (package:fcm_config/src/io_notifications_manager.dart:105:41)
E/flutter (18982): #7      AndroidFlutterLocalNotificationsPlugin._handleMethod (package:flutter_local_notifications/src/platform_flutter_local_notifications.dart:459:32)
E/flutter (18982): #8      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:404:55)
E/flutter (18982): #9      MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:397:34)
E/flutter (18982): #10     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:389:35)
E/flutter (18982): #11     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:386:46)
E/flutter (18982): #12     _invoke2.<anonymous closure> (dart:ui/hooks.dart:189:15)
E/flutter (18982): #13     _rootRun (dart:async/zone.dart:1428:13)
E/flutter (18982): #14     _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter (18982): #15     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
E/flutter (18982): #16     _invoke2 (dart:ui/hooks.dart:188:10)
E/flutter (18982): #17     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
E/flutter (18982): #18     _Channel.push (dart:ui/channel_buffers.dart:132:31)
E/flutter (18982): #19     ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
E/flutter (18982): #20     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:544:22)
E/flutter (18982): #21     _dispatchPlatformMessage (dart:ui/hooks.dart:83:31)
E/flutter (18982): 

Support image notifications

I already did that part to receive and view notifications with images with the normal way using the library of local notifications, but scince I depend on your library now in that project, so is it support that or we need to work on it?

how to handle notification while app is terminated

``hello brother , when i click on notification while app is in background i can open a particular screen but while app is terminated i can't open particular Screen
this is my code in main.dart file

Future<void> _firebaseMessagingBackgroundHandler(
    RemoteMessage notification) async {
  await Firebase.initializeApp();
  prefs = await SharedPreferences.getInstance();

  log('TOOKEN' + await FirebaseMessaging.instance.getToken());
  // log(message.data.toString(),);

  // log(message..toString(),);
  if (notification.data['model'] == 'order') {
    if (prefs.getString('user_type') == 'customer') {
      N.to(
        OrderHistoryDetailsScreen(
          orderId: notification.data['model_id'],
        ),
      );
    } else if (prefs.getString('user_type') == 'owner') {
      N.to(
        RequestDetailsScreen(
          requestId: notification.data['model_id'],
        ),
      );
    }
  } else if (notification.data['model'] == 'product') {
    if (prefs.getString('user_type') == 'customer') {
      N.to(
        ProductDetailsScreen(
          productId: notification.data['model_id'],
        ),
      );
    } else if (prefs.getString('user_type') == 'owner') {
      N.to(
        MyProductDetailsScreen(
          productId: notification.data['model_id'],
        ),
      );
    }
  } else if (notification.data['model'] == 'payment') {
    if (prefs.getString('user_type') == 'owner') {
      N.to(
        SubscriptionsScreen(),
      );
    }
  } else if (notification.data['model'] == 'home') {
    if (prefs.getString('user_type') == 'customer') {
      N.to(
        TabScreen(),
      );
    } else if (prefs.getString('user_type') == 'owner') {
      N.to(
        ProviderHomeScreen(),
      );
    }
  }

  // print("Handling a background message: ${message.data['model']}");
}

SharedPreferences prefs;

void main() async {
  // log('message');
  await FCMConfig.instance
      .init(
    onBackgroundMessage: _firebaseMessagingBackgroundHandler,
    alert: true,
    announcement: true,
    badge: true,
    displayInForeground: true,
    carPlay: false,
    criticalAlert: true,
    provisional: false,
    sound: true,
  )
      .then((value) {
    // FirebaseMessaging.instance.onTokenRefresh.listen((event) {});
  });
  WidgetsFlutterBinding.ensureInitialized();
  await Intercom.initialize('gypd03cb',
      iosApiKey: 'ios_sdk-bf99d566d7baa560cb0f02514951e4e217835d21',
      androidApiKey: 'android_sdk-fb0b9293fba93d7adbd31f729dd4a2a69b646d42');

  await localization.init();
  await Firebase.initializeApp();
  
  log('TOOKEN' + await FirebaseMessaging.instance.getToken());

  prefs = await SharedPreferences.getInstance();
  runApp(
    Phoenix(
      child: MyApp(),
    ),
  );
}

my AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.afran">
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.VIBRATE"/>  
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

   <application
        android:label="afran_flutter"
        android:icon="@mipmap/launcher_icon" android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true">

    <meta-data android:name="com.google.android.geo.API_KEY" 
    android:value="AIzaSyBbQpHFXEziURi4Q5RpDD5kEgfeJ6-3l3Q"/>        
        <activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
        <activity
            android:name=".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">
            <!-- 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"
              />
            <!-- 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"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="NOTIFICATION_CLICK"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <intent-filter>
               <action android:name="android.intent.action.VIEW" />
               <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
               <data
                 android:host="afran.sa"
                 android:pathPrefix="/"
                 android:scheme="https" />
            </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" />
    </application>
</manifest>

thanks brother

Unhandled Exception: LateInitializationError: Field '_localeNotification@885028921' has not been initialized.

I get this error after initializing and setting the package

I imported

firebase_core: ^1.10.6
fcm_config: ^3.3.1
firebase_messaging: ^11.2.4
flutter_local_notifications: ^9.1.5

main function

`void main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
await FlutterLocalNotificationsPlugin().initialize;
await FCMConfig.instance
.init(
defaultAndroidForegroundIcon: '@mipmap/launcher_icon', //default is @mipmap/ic_launcher
defaultAndroidChannel: AndroidNotificationChannel(
'high_importance_channel',// same as value from android setup
'Fcm config',
importance: Importance.high,
sound: RawResourceAndroidNotificationSound('notification'),
),
);

FCMConfig.instance.init(
onBackgroundMessage: _firebaseMessagingBackgroundHandler,
defaultAndroidChannel: AndroidNotificationChannel(
'high_importance_channel',// same as value from android setup
'Fcm config',
importance: Importance.high,
sound: RawResourceAndroidNotificationSound('notification'),
),
);

runApp(const MyApp());
}`

Unhandled Exception: PlatformException(invalid_led_details, Must specify both ledOnMs and ledOffMs to configure the blink cycle on older versions of Android before Oreo, null, null)

] Unhandled Exception: PlatformException(invalid_led_details, Must specify both ledOnMs and ledOffMs to configure the blink cycle on older versions of Android before Oreo, null, null)
E/flutter (11829): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607)
E/flutter (11829): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167)
E/flutter (11829):
E/flutter (11829): #2 FlutterLocalNotificationsPlugin.show (package:flutter_local_notifications/src/flutter_local_notifications_plugin.dart:234)
E/flutter (11829):
E/flutter (11829): #3 NotificationManager.displayNotificationFrom (package:fcm_config/src/io_notifications_manager.dart:356)
E/flutter (11829):
E/flutter (11829):

[✓] Flutter (Channel stable, 3.0.0, on macOS 12.6 21G115 darwin-arm (Rosetta), locale en-EG)
• Flutter version 3.0.0 at
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (6 months ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
• Android SDK at /Users/tebalink/Library/Android/sdk
• Platform android-33, build-tools 33.0.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 69.0.5
• Dart plugin version 222.3345.108

[✓] Connected device (4 available)
• SM G610F (mobile) • 5203fd5afa51b33f • android-arm • Android 8.1.0 (API 27)
• SM T295 (mobile) • R9WR603YMCJ • android-arm64 • Android 11 (API 30)
• sayed (mobile) • 00008101-000251C60C01001E • ios • iOS 16.0 20A362
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm (Rosetta)

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 1 category.
Process finished with exit code 0

in iOS forground it create 2 notifications!

In Android it work fine and it show the right notification in all cases with the handling of the tapping event but in iOS I have 2 issues:

  • in Foreground it create 2 notifications
  • in app killed mode the tapping on notification not oppening the app at all

Any help in that?

notifications only works when the app is closed. when it's working, they don't work

await FCMConfig.instance.init(
defaultAndroidChannel: AndroidNotificationChannel(
'General',
'Fcm config',
importance: Importance.max,
playSound: true,
ledColor: Colors.green,
enableLights: true,
sound: RawResourceAndroidNotificationSound('notification'),

),
  onBackgroundMessage:_firebaseMessagingBackgroundHandler,
  alert: true,
  sound: true,
  //provisional: true,

);

Cannot show notification

E/MethodChannel#dexterous.com/flutter/local_notifications(14214): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setAction(java.lang.String)' on a null object reference
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.createNotification(FlutterLocalNotificationsPlugin.java:217)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.showNotification(FlutterLocalNotificationsPlugin.java:1146)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.show(FlutterLocalNotificationsPlugin.java:1462)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1299)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at android.os.Looper.loop(Looper.java:214)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at android.app.ActivityThread.main(ActivityThread.java:7386)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#dexterous.com/flutter/local_notifications(14214): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
E/flutter (14214): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setAction(java.lang.String)' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Intent.setAction(java.lang.String)' on a null object reference

Why this plugin only provide widget?

I want to receive push notification in provider.

I can use the onNotification callback to receive it in the provider, but it's inconvenient to have to use the widget.

Is it possible to receive push notification directory in provider?

No Firebase App IOS

Unhandled Exception: [core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()
#0 MethodChannelFirebase.app (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:159:5)
#1 Firebase.app (package:firebase_core/src/firebase.dart:53:41)
#2 FirebaseMessaging.instance (package:firebase_messaging/src/messaging.dart:32:47)
#3 FCMConfig.messaging (package:fcm_config/src/fcm_config.dart:18:56)
#4 _SplashState.initApp (package:sam_card/screen/Splash.dart:128:41)

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.