所以我更新了firebase_messaging并且我不得不更改我的代码,因为FirebaseMessagin.configure()它已被弃用,现在当我收到通知并单击通知时,它不会打开另一个屏幕。
这就是我实现通知的方式:
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
print('Handling a background message ${message.messageId}');
}
const AndroidNotificationChannel channel = AndroidNotificationChannel(
'high_importance_channel', // id
'High Importance Notifications', // title
'This channel is used for important notifications.', // description
importance: Importance.high,
);
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'e-R?d?u?i',
debugShowCheckedModeBanner: false,
initialRoute: …Run Code Online (Sandbox Code Playgroud) android push-notification flutter remote-notifications firebase-cloud-messaging
我已经使用以下插件在Cordova应用程序中实现了推送通知
它在应用程序中接收通知(但不在通知区域中).但是,当我的应用程序处于后台时,它不会显示任何通知.
所以它只在应用程序处于前台时才有效.
所以,我有两个问题:
如何在通知区域显示收到的通知?
即使我的应用程序处于后台,如何收到通知?
Skype新的iOS应用程序允许您回复推送通知,我如何在自己的应用程序中执行此操作?
我认为我的对象检测会起作用:
if (Notification!=undefined) {}
Run Code Online (Sandbox Code Playgroud)
但是我的 JavaScript 日志仍然显示以下错误:
未捕获的 ReferenceError:未定义通知
如何正确地对物体进行物体检测Notification?
没有框架。
我正在使用应用程序,我需要使用推送通知.我知道推送通知是正常的权限,所以我不能在运行时询问它.但是我会在用户下载并安装应用程序时插入权限,通知应用程序应该发送推送通知.我该怎么做?我必须在清单中插入一些东西吗?谢谢
我对ios开发很陌生。最近我在某处读到 Apple 现在允许在开发过程中将推送通知集成到应用程序中,而不是在未付费的苹果帐户上进行生产。但是,我在尝试在 xcode 上为我的应用程序启用推送通知功能时遇到了问题,这让我怀疑我们是否真的需要付费会员才能在我们的应用程序上添加推送通知功能。
我没有找到任何正确的解决方案来使用 websocket 实现推送通知。
我的简单要求就像 WhatsApp 聊天一样,当消息到来时,它会以推送通知的形式显示该消息。
这是推送通知的文档。
/**
* Push notification code
*/
import { PushNotifications } from '@capacitor/push-notifications';
const addListeners = async () => {
await PushNotifications.addListener('registration', token => {
console.info('Registration token: ', token.value);
});
await PushNotifications.addListener('registrationError', err => {
console.error('Registration error: ', err.error);
});
await PushNotifications.addListener('pushNotificationReceived', notification => {
console.log('Push notification received: ', notification);
});
await PushNotifications.addListener('pushNotificationActionPerformed', notification => {
console.log('Push notification action performed', notification.actionId, notification.inputValue);
});
}
const registerNotifications = async () => {
let permStatus …Run Code Online (Sandbox Code Playgroud)