我是 flutter 新手,我只是想将 firebase 推送通知接收到我的 flutter 应用程序。当应用程序关闭并在后台时,会收到推送通知。但是当应用程序打开时,正在接收推送通知,但它没有显示警报通知(我想在我的应用程序打开时将推送通知标题和正文显示为警报)。这是我的代码。
_fcm.configure(
onMessage: (Map<String, dynamic> message) async {
showDialog(
context: context,
builder: (context) => AlertDialog(
content: ListTile(
title: Text(message['notification']['title']),
subtitle: Text(message['notification']['body']),
),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () => Navigator.of(context).pop(),
),
],
),
);
print("onMessage: $message");
},
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch: $message");
},
onResume: (Map<String, dynamic> message) async {
print("onResume: $message");
},
);
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
当我尝试在 Android 上构建我的离子移动应用程序时,出现以下错误。
\nAn error occurred during the build:\nError: The target entry-point "@ionic-native/media-capture" has missing dependencies:\n - @ionic-native/core\n\n at TargetedEntryPointFinder.findEntryPoints (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40:23)\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/analyze_entry_points.js:28:41\n at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:28:29)\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:59\n at SyncLocker.lock (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:34:24)\n at SingleProcessExecutorSync.execute (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:27)\n at Object.mainNgcc (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/src/main.js:74:25)\n at Object.process (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@angular/compiler-cli/ngcc/index.js:29:23)\n at NgccProcessor.processModule (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ngcc_processor.js:163:16)\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ivy/host.js:55:18\n at /Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ivy/host.js:47:24\n at Array.map (<anonymous>)\n at Object.host.resolveModuleNames (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/@ngtools/webpack/src/ivy/host.js:45:32)\n at actualResolveModuleNamesWorker (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/typescript/lib/typescript.js:102904:133)\n at resolveModuleNamesWorker (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/typescript/lib/typescript.js:103126:26)\n at resolveModuleNamesReusingOldState (/Users/prabhashibuddhima/Documents/Personal/Projects/VRec/myVideo/node_modules/typescript/lib/typescript.js:103200:24)\nAn unhandled exception occurred: The target entry-point "@ionic-native/media-capture" has missing dependencies:\n - @ionic-native/core\n\nSee "/private/var/folders/vp/8s5chkws6tx5v3wjyvr7n_qm0000gn/T/ng-HBL1kz/angular-errors.log" for further details.\nRun Code Online (Sandbox Code Playgroud)\n …