Orientação gerada a partir de informações públicas. Apenas para referência.
Um plugin Flutter para lidar com notificações push de VoIP, atualmente compatível com iOS 8.0 e versões posteriores. Permite que aplicativos de comunicação em tempo real recebam notificações push mesmo quando o app está encerrado, garantindo conectividade confiável para chamadas. O pacote integra-se ao serviço de notificações push da Apple (APNs) para entregar notificações silenciosas de VoIP, permitindo a ativação do app em segundo plano para chamadas entrantes. Projetado especificamente para aplicações de voz sobre IP, como chamadas VoIP ou plataformas de mensagens que exigem entrega imediata de notificações. Funciona perfeitamente dentro do ecossistema Flutter com configuração mínima. Sem suporte para Android neste momento.
Casos de uso
Aplicativos de chamada VoIP em tempo real
Notificações de chamada em segundo plano
Tratamento de notificação push silenciosa
Acordar o aplicativo em chamadas recebidas
Plataformas de comunicação por voz
Principais recursos
Suporte a push VoIP exclusivo para iOS
Entrega silenciosa de notificações
Ativação de aplicativo em segundo plano
Integração do Apple APNs
Configuração mínima necessária
Indicado para
desenvolvedores de aplicativos VoIP
Aplicativos de comunicação em tempo real
Projetos Flutter voltados para iOS
sistemas de roteamento de chamadas
Aplicativos que precisam de notificações em segundo plano confiáveis
Considerações
Sem suporte ao Android
Requer iOS 8.0 ou superior
É necessário configurar o certificado APNs
Limitado a casos de uso de VoIP
Dependente da infraestrutura de push da Apple
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Flutter VoIP Push Notification
Flutter VoIP Push Notification - Currently iOS >= 8.0 only
Motivation
Since iOS 8.0 there is an execellent feature called VoIP Push Notification (PushKit), while firebase_messaging does not support voip push notification which is only available on iOS >= 8.0 which is the reason for this plugin.
To understand the benefits of Voip Push Notification, please see VoIP Best Practices.
import'package:flutter/material.dart';
import'package:flutter/material.dart';
import'dart:async';
import'package:flutter_voip_push_notification/flutter_voip_push_notification.dart';
voidmain() => runApp(MyApp());
classMyAppextendsStatefulWidget{
@override_MyAppStatecreateState() => _MyAppState();
}
class_MyAppStateextendsState<MyApp> {
String _pushToken = '';
FlutterVoipPushNotification _voipPush = FlutterVoipPushNotification();
@overridevoidinitState() {
super.initState();
configure();
}
// Configures a voip push notificationFuture<void> configure() async {
// request permission (required)await _voipPush.requestNotificationPermissions();
// listen to voip device token changes
_voipPush.onTokenRefresh.listen(onToken);
// do configure voip push
_voipPush.configure(onMessage: onMessage, onResume: onResume);
}
/// Called when the device token changesvoidonToken(String token) {
// send token to your apn provider serversetState(() {
_pushToken = token;
});
}
/// Called to receive notification when app is in foreground////// [isLocal] is true if its a local notification or false otherwise (remote notification)/// [payload] the notification payload to be processed. use this to present a local notificationFuture<dynamic> onMessage(bool isLocal, Map<String, dynamic> payload) {
// handle foreground notificationprint("received on foreground payload: $payload, isLocal=$isLocal");
returnnull;
}
/// Called to receive notification when app is resuming from background////// [isLocal] is true if its a local notification or false otherwise (remote notification)/// [payload] the notification payload to be processed. use this to present a local notificationFuture<dynamic> onResume(bool isLocal, Map<String, dynamic> payload) {
// handle background notificationprint("received on background payload: $payload, isLocal=$isLocal");
showLocalNotification(payload);
returnnull;
}
showLocalNotification(Map<String, dynamic> notification) {
String alert = notification["aps"]["alert"];
_voipPush.presentLocalNotification(LocalNotification(
alertBody: "Hello $alert",
));
}
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
home: Scaffold(
appBar: AppBar(
title: constText('Plugin example app'),
),
body: Center(
child: Text('Received Voip Push token: $_pushToken\n'),
),
),
);
}
}