Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev1.0.0

notification_listener_service

Plugin Flutter para ouvir todas as notificações recebidas (postadas ou removidas) com a possibilidade de responder a elas

Android
Downloads em 30 dias
3,2 mil
Curtidas
72
Pontos Pub
160

Instalar pacote

flutter pub add notification_listener_service

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Um plugin Flutter para Android que permite aos aplicativos escutar notificações recebidas, incluindo sua publicação e remoção. Ele suporta respostas diretas às notificações diretamente do app, tornando-o ideal para ferramentas de mensagens ou automação. O plugin utiliza a API NotificationListenerService do Android para monitorar notificações do sistema em tempo real. Os desenvolvedores podem acessar detalhes das notificações, como título, texto, nome do pacote e carimbo de data/hora. Requer permissão do usuário para ativar o serviço de escuta, garantindo privacidade e segurança. Projetado especificamente para Android, integra-se perfeitamente em projetos Flutter existentes.

Casos de uso

  • Monitoramento de notificações em tempo real
  • Respostas automáticas de mensagens
  • Fluxos de trabalho baseados em notificações
  • Integração do aplicativo com notificações do sistema
  • rastreamento de notificações consciente de privacidade

Principais recursos

  • Escuta todas as notificações recebidas e removidas
  • Suporta a função de resposta direta
  • Compatibilidade de plataforma exclusiva para Android
  • Acesso seguro baseado em permissão
  • Fornece metadados detalhados de notificação

Indicado para

  • Desenvolvedores criando ferramentas de automação de notificações
  • Aplicativos que exigem insights em tempo real sobre notificações
  • Aplicativos de mensagens ou bate-papo
  • Integrações de nível do sistema no Android
  • Manipuladores de notificação focados em privacidade

Considerações

  • Requer configuração e permissões específicas do Android
  • O usuário deve habilitar manualmente o serviço de escuta
  • Limitado à plataforma Android
  • Pode afetar a vida útil da bateria com escuta contínua
  • O acesso a dados sensíveis exige manuseio cuidadoso

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

notification_listener_service

A flutter plugin for interacting with Notification Service in Android.

NotificationListenerService is a service that receives calls from the system when new notifications are posted or removed,

for more info check NotificationListenerService

Installation and usage

Add package to your pubspec:

dependencies:
  notification_listener_service: any # or the latest version on Pub

Inside AndroidManifest add this to bind notification service with your application


<service android:label="notifications" android:name="notification.listener.service.NotificationListener"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" android:exported="true">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>


USAGE
 /// check if notification permession is enebaled
 final bool status = await NotificationListenerService.isPermissionGranted();

 /// request notification permission
 /// it will open the notifications settings page and return `true` once the permission granted.
 final bool status = await NotificationListenerService.requestPermission();

 /// stream the incoming notification events
  NotificationListenerService.notificationsStream.listen((event) {
    log("Current notification: $event");
  });

The ServiceNotificationEvent provides:

  /// the notification id
  int? id;

  /// check if we can reply the Notification
  bool? canReply;

  /// if the notification has an extras image
  bool? haveExtraPicture;

  /// if the notification has been removed
  bool? hasRemoved;

  /// notification extras image
  /// To display an image simply use the [Image.memory] widget.
  Uint8List? extrasPicture;

  /// notification large icon
  /// To display an image simply use the [Image.memory] widget.
  Uint8List? largeIcon;

  /// notification package name
  String? packageName;

  /// notification title
  String? title;

  /// the notification app icon
  /// To display an image simply use the [Image.memory] widget.
  Uint8List? appIcon;

  /// the content of the notification
  String? content;

  /// send a direct message reply to the incoming notification
  Future<bool> sendReply(String message)

To reply to a notification provides:

  try {
    await event.sendReply("This is an auto response");
  } catch (e) {
    log(e.toString());
  }

Example of the app on foreground

Find the exemple app Here

Screenshots

Categorias

Repositório-fonte

Projetos que usam este pacote