-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Firebase Push notification Problem #18192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this needs more information.
I think for sound |
@zoechi the sound issue is fixed by adding ur line. So I created a testing app with schedule notification library example,it shows notification even the app is opened and minimized,theres no issues. then i decided to Add this shcedule notification project's .dart file as a new page |
I haven't tried one of the schedule notification packages myself yet, |
@zoechi this is my code, today also it worked fine when app is minimized,but not when app is opened or closed Is there any mistakes: My Flutter code: import 'package:flutter/material.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_database/firebase_database.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String textValue = 'Hello World !';
FirebaseMessaging firebaseMessaging = new FirebaseMessaging();
@override
void initState() {
firebaseMessaging.configure(onLaunch: (Map<String, dynamic> msg) {
print(" onLaunch called");
}, onResume: (Map<String, dynamic> msg) {
print(" onResume called");
}, onMessage: (Map<String, dynamic> msg) {
print(" onMessage called");
});
firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(sound: true, alert: true, badge: true));
firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings setting) {
print('IOS Setting Registed');
});
firebaseMessaging.getToken().then((token) {
update(token);
});
} My firebase code: const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firbase);
exports.Novamachineries = functions.database.ref('items/{id}').onWrite(evt =>
{
const payload = {
notification: { title: 'New Customer Requested', body: 'Touch to Open The
App', badge: '1', sound: 'default', }
};
/////////////////////////////////////////////////////////////////////
const token = "abcdefghijklmnopqrstuvwxyz";
//i know token will varry ,
so when the app is st1 timme opened it will write that token in firebase ,
i will note that tokken then i'll write that code in this Firebase code,
then i'll deploy it[it works fine too]
/////////////////////////////////////////////////////////////////////
if (token) {
console.log('Toke is availabel .');
return admin.messaging().sendToDevice(token, payload);
} else {
console.log('token error');
}
}); Only shows when app is minimized,Whats the error in my App code |
@zoechi its me, the same person brother |
on app open, the callback
u should display the notification instead of printing here |
@rajeshjeshar can this issue be closed? |
@zoechi yes this can be closed and notifications are working 100%,now i'm writing a medium post on the way so it can be closed now thanks |
Thanks for the update. |
@zoechi here is the post in medium thanks>> |
when i try to onBackgroundMessage its says unknown paramter |
There is no onBackgroundMessage inf Firebase messagiung Plugin.Hope you are asking about the OnLaunch() OnResume() methods ?? |
I think there is in the new flutter_messaging plugin version |
Yeah! sorry Just now i've seen that change Log. |
@rajeshjeshar This issue has been moved to firebase/flutterfire#809. Any further collaboration will be done there. |
7e205b3 Roll src/fuchsia/sdk/mac from 1MVsE... to 4MCVP... (flutter#18217) 9193d8f Roll src/third_party/skia 0dc207f836da..a14084ba1b41 (3 commits) (flutter#18219) 403931f Add FlValue (flutter#18185) 46a6d96 [SkParagraph] Copy text height behavior to the Skia paragraph style (flutter#18178) e7ee47d [web] Implement matrix parameter for linear gradient (flutter#18208) 28d9985 Reland again "Remove layer integral offset snapping flutter#17112" (flutter#18160) 5e361f5 Roll src/third_party/skia c66cd987f7c0..0dc207f836da (5 commits) (flutter#18212) 716dbf0 Refactor GLFW embedding to support headless mode (flutter#18205) 23cca32 Manual Roll of Dart 39e0e75fcf...ce62ad2e8b (flutter#18211) 15f72b8 Support EventChannel C++ plugin API for Linux/Windows (flutter#17015) e5a7ca5 Handle leak of message handle when no engine present (flutter#18157) d3bde19 add docs to platformviewios (and some drive-by changes) (flutter#17593) b582d77 Roll src/third_party/skia 0066adefa97d..c66cd987f7c0 (4 commits) (flutter#18206) 5e7d6d0 Roll src/third_party/skia edea19858ccc..0066adefa97d (3 commits) (flutter#18203) 88b9d42 Remove the global engine entry timestamp (flutter#18182) 0dffdd5 Roll src/third_party/dart e86e4d61834a..ce62ad2e8b40 (13 commits) (flutter#18201) 56fe6d2 Roll src/third_party/skia 2871ab0727bf..edea19858ccc (3 commits) (flutter#18198) bcdf991 Fixed ChildSceneLayer elevation issue on Fuchsia. (flutter#18144) ede658e [profiling] CPU Profiling support for iOS (flutter#18087) d043923 Roll src/third_party/skia e3d1de7c5281..2871ab0727bf (1 commits) (flutter#18197) 807f191 Roll src/third_party/dart 733153eb517c..e86e4d61834a (6 commits) (flutter#18195) fe3f8df Roll src/third_party/skia 3b2db26c59d6..e3d1de7c5281 (4 commits) (flutter#18192) 34b0629 Roll fuchsia/sdk/core/mac-amd64 from jMJqf... to 1MVsE... (flutter#18194) e9b2afe Roll fuchsia/sdk/core/linux-amd64 from RpHTv... to MhpFP... (flutter#18191) 35fa006 Roll src/third_party/skia 88d04cb51acf..3b2db26c59d6 (1 commits) (flutter#18190) e54bb9e Roll src/third_party/dart 4da5b40fb6dc..733153eb517c (23 commits) (flutter#18188)
7e205b3 Roll src/fuchsia/sdk/mac from 1MVsE... to 4MCVP... (flutter#18217) 9193d8f Roll src/third_party/skia 0dc207f836da..a14084ba1b41 (3 commits) (flutter#18219) 403931f Add FlValue (flutter#18185) 46a6d96 [SkParagraph] Copy text height behavior to the Skia paragraph style (flutter#18178) e7ee47d [web] Implement matrix parameter for linear gradient (flutter#18208) 28d9985 Reland again "Remove layer integral offset snapping flutter#17112" (flutter#18160) 5e361f5 Roll src/third_party/skia c66cd987f7c0..0dc207f836da (5 commits) (flutter#18212) 716dbf0 Refactor GLFW embedding to support headless mode (flutter#18205) 23cca32 Manual Roll of Dart 39e0e75fcf...ce62ad2e8b (flutter#18211) 15f72b8 Support EventChannel C++ plugin API for Linux/Windows (flutter#17015) e5a7ca5 Handle leak of message handle when no engine present (flutter#18157) d3bde19 add docs to platformviewios (and some drive-by changes) (flutter#17593) b582d77 Roll src/third_party/skia 0066adefa97d..c66cd987f7c0 (4 commits) (flutter#18206) 5e7d6d0 Roll src/third_party/skia edea19858ccc..0066adefa97d (3 commits) (flutter#18203) 88b9d42 Remove the global engine entry timestamp (flutter#18182) 0dffdd5 Roll src/third_party/dart e86e4d61834a..ce62ad2e8b40 (13 commits) (flutter#18201) 56fe6d2 Roll src/third_party/skia 2871ab0727bf..edea19858ccc (3 commits) (flutter#18198) bcdf991 Fixed ChildSceneLayer elevation issue on Fuchsia. (flutter#18144) ede658e [profiling] CPU Profiling support for iOS (flutter#18087) d043923 Roll src/third_party/skia e3d1de7c5281..2871ab0727bf (1 commits) (flutter#18197) 807f191 Roll src/third_party/dart 733153eb517c..e86e4d61834a (6 commits) (flutter#18195) fe3f8df Roll src/third_party/skia 3b2db26c59d6..e3d1de7c5281 (4 commits) (flutter#18192) 34b0629 Roll fuchsia/sdk/core/mac-amd64 from jMJqf... to 1MVsE... (flutter#18194) e9b2afe Roll fuchsia/sdk/core/linux-amd64 from RpHTv... to MhpFP... (flutter#18191) 35fa006 Roll src/third_party/skia 88d04cb51acf..3b2db26c59d6 (1 commits) (flutter#18190) e54bb9e Roll src/third_party/dart 4da5b40fb6dc..733153eb517c (23 commits) (flutter#18188)
7e205b3 Roll src/fuchsia/sdk/mac from 1MVsE... to 4MCVP... (#18217) 9193d8f Roll src/third_party/skia 0dc207f836da..a14084ba1b41 (3 commits) (#18219) 403931f Add FlValue (#18185) 46a6d96 [SkParagraph] Copy text height behavior to the Skia paragraph style (#18178) e7ee47d [web] Implement matrix parameter for linear gradient (#18208) 28d9985 Reland again "Remove layer integral offset snapping #17112" (#18160) 5e361f5 Roll src/third_party/skia c66cd987f7c0..0dc207f836da (5 commits) (#18212) 716dbf0 Refactor GLFW embedding to support headless mode (#18205) 23cca32 Manual Roll of Dart 39e0e75fcf...ce62ad2e8b (#18211) 15f72b8 Support EventChannel C++ plugin API for Linux/Windows (#17015) e5a7ca5 Handle leak of message handle when no engine present (#18157) d3bde19 add docs to platformviewios (and some drive-by changes) (#17593) b582d77 Roll src/third_party/skia 0066adefa97d..c66cd987f7c0 (4 commits) (#18206) 5e7d6d0 Roll src/third_party/skia edea19858ccc..0066adefa97d (3 commits) (#18203) 88b9d42 Remove the global engine entry timestamp (#18182) 0dffdd5 Roll src/third_party/dart e86e4d61834a..ce62ad2e8b40 (13 commits) (#18201) 56fe6d2 Roll src/third_party/skia 2871ab0727bf..edea19858ccc (3 commits) (#18198) bcdf991 Fixed ChildSceneLayer elevation issue on Fuchsia. (#18144) ede658e [profiling] CPU Profiling support for iOS (#18087) d043923 Roll src/third_party/skia e3d1de7c5281..2871ab0727bf (1 commits) (#18197) 807f191 Roll src/third_party/dart 733153eb517c..e86e4d61834a (6 commits) (#18195) fe3f8df Roll src/third_party/skia 3b2db26c59d6..e3d1de7c5281 (4 commits) (#18192) 34b0629 Roll fuchsia/sdk/core/mac-amd64 from jMJqf... to 1MVsE... (#18194) e9b2afe Roll fuchsia/sdk/core/linux-amd64 from RpHTv... to MhpFP... (#18191) 35fa006 Roll src/third_party/skia 88d04cb51acf..3b2db26c59d6 (1 commits) (#18190) e54bb9e Roll src/third_party/dart 4da5b40fb6dc..733153eb517c (23 commits) (#18188)
I am using this code but the sound in not there when the notification is delivered. |
@shikharvaish28 did you find any solution yet ? |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Scene1:
When i tried to send push notifications manually via Firebase coud Messaging console,it shows notifications without sound alert
Scene2:
When i disconnect my device then Restarted the "Run" in Adroid studio,its not receiving any Notifications, [I MUST HAVE TO Go to my Mobile settings>Notifications>selecting the app then toggle between Turn Off And Turn On the "Show Notifications"]
Scene3:
Even I have typed onresume(),onmessage(),onLaunch() functions,Its not showing notifications after closing the app
Scene4:
When i try to trigger Firebase Realtime Database,[When a entry is added or deleted i must receive notifications] its not working,But the code itself is deployed successfully??
Scene5:
Scheduled notifications are working fine with sound alerts too..but firebase notificationsare not working
Device: REDMI 4
IDE: VsCode ,Android Studio,
The text was updated successfully, but these errors were encountered: