패키지, 저장소 및 앱 카테고리 검색

reflex 표지
패키지 상세v0.0.2

reflex

알림을 읽고 사용자 정의 메시지로 자동 회신하는 Flutter 플러그인입니다.

AndroidiOS
30일 다운로드
15
좋아요
42
Pub 점수
130

패키지 설치

flutter pub add reflex

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Reflex는 Flutter 플러그인으로, 앱이 들어오는 알림을 읽고 자동으로 사용자 정의 응답을 보내도록 해줍니다. Android와 iOS용으로 설계되었으며, 시스템 수준의 알림 서비스와 통합되어 메시지를 프로그래밍 방식으로 모니터링하고 응답할 수 있습니다. 챗봇, 자동 고객 지원 또는 스마트 메시징 워크플로우에 적합하며, Reflex를 통해 개발자는 실시간 알림에 반응하는 반응형 애플리케이션을 만들 수 있습니다. 이 플러그인은 오픈소스이며 devsonflutter에서 유지보수되며 pub.dev를 통해 간편하게 통합할 수 있습니다. 두 플랫폼 모두 지원하므로 크로스플랫폼 메시징 기능 향상에 적합합니다.

사용 사례

  • 자동 챗봇 응답
  • 스마트 알림 처리
  • 고객 지원 자동화
  • 실시간 메시지 모니터링
  • 크로스 플랫폼 메시징 앱

주요 기능

  • 수신 알림을 읽습니다
  • 사용자 정의 메시지가 포함된 자동 응답
  • Android 및 iOS를 지원합니다
  • 오픈소스이며 커뮤니티 주도
  • pub.dev를 통한 간단한 통합

적합한 대상

  • 챗봇을 개발하는 개발자
  • 자동 응답이 필요한 앱
  • 메시징 및 지원 도구
  • 크로스 플랫폼 알림 시스템
  • 자동화 중심의 Flutter 프로젝트

고려 사항

  • 알림 접근 권한에 대한 사용자 허용이 필요합니다
  • 시스템 알림 읽기만 가능
  • 모든 디바이스 제조업체에서 작동하지 않을 수 있습니다
  • 플랫폼별 백그라운드 실행에 의존합니다
  • 개인정보에 민감한 사용 사례는 투명성을 필요로 합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Reflex

Flutter plugin for notification read & reply.

Flutter_Shortcuts

GitHub GitHub code size in bytes GitHub top language GitHub language count GitHub tag (latest by date) GitHub issues GitHub Repo stars GitHub forks

Compatibility

✅   Android
❌   iOS (active issue: iOS support for reflex)

Show some :heart: and :star: the repo

Why use Reflex?

Reflex Plugin is known for:

Reflex
Fast, performant & compatible
Free & Open-source
Production ready
Make App Reactive

Features

All the features listed below can be performed at the runtime.

✅   Get Notification Stream
✅   Read Notification
✅   Reply From Notification
✅   Auto Reply

Demo

Quick Start

Step 1: Include plugin to your project
dependencies:
  reflex: <latest version>

Run pub get and get packages.

Step 2: Add Service in AndroidManifest.xml

Add the following service inside the application tag of AndroidManifest.xml.

    ...
    <service
        android:label="notifications"
        android:name="com.devsonflutter.reflex.notification.NotificationListener"
        android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>
</application>

Android 12+ Compatibility Add android:exported="true" field in the service tag to make it compatible with Android 12+.

    ...
    <service
        android:label="notifications"
        android:name="com.devsonflutter.reflex.notification.NotificationListener"
        android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
        android:exported="true">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>
</application>
Step 3: Instantiate Reflex

Reflex must only be instantiated only once.

Reflex reflex = Reflex();

Example

Go to example section in pub.dev to see the full example code.

In GitHub, head over to example/lib/main.dart to see the full example code.

Import

This single import is enough for using reflex.

import 'package:reflex/reflex.dart';
Listen & Reply
StreamSubscription<ReflexEvent>? _subscription;
final List<ReflexEvent> _notificationLogs = [];
final List<ReflexEvent> _autoReplyLogs = [];
bool isListening = false;

Reflex reflex = Reflex(
  debug: true,
  packageNameList: ["com.whatsapp", "com.tyup"],
  packageNameExceptionList: ["com.android.systemui"],
  autoReply: AutoReply(
    packageNameList: ["com.whatsapp"],
    message: "[Reflex] This is an automated reply.",
  ),
);

@override
void initState() {
  super.initState();
  initPlatformState();
}

Future<void> initPlatformState() async {
  startListening();
}

void onData(ReflexEvent event) {
  setState(() {
    if (event.type == ReflexEventType.notification) {
      _notificationLogs.add(event);
    } else if (event.type == ReflexEventType.reply) {
      _autoReplyLogs.add(event);
    }
  });
  debugPrint(event.toString());
}

void startListening() {
  try {
    _subscription = reflex.notificationStream!.listen(onData);
    setState(() {
      isListening = true;
    });
  } on ReflexException catch (exception) {
    debugPrint(exception.toString());
  }
}

void stopListening() {
  _subscription?.cancel();
  setState(() => isListening = false);
}

Quick Guide

A quick guide to Flutter Reflex plugin!

Debugging

Debugging allows you to debug the plugin's functionality, logs are shown in the console.

By default debug logging is enabled. You can configure it using the debug field in the Reflex class.

Reflex reflex = Reflex(
  debug: false,
);
Listen notification permission

See if listening notification permission has been granted or not.

bool isPermissionGranted = await Reflex.isPermissionGranted;
Request notification listening permission

Use the function to grant notification listening permission.

await Reflex.requestPermission();
Notification Stream

Use the reflex object to get a notification stream to listen to notifications in your flutter application.

StreamSubscription<ReflexEvent>? _subscription;
_subscription = reflex.notificationStream!.listen((event) {
  // Application Logic
});

The stream is subscribed for ReflexEvent whenever a notification is received.

Reflex Event

The incoming reflex event contains:

  • type: ReflexEventType.notification whenever a notification is received to flutter application, and ReflexEventType.reply whenever an automated reply is sent.

  • packageName: Application's package name from which notifications are received and reply are sent.

  • title: Notification title

  • message: Message contained in the notification and while sending reply.

  • timestamp: Timestamp of the notification received and reply sent.

Listen notification from specific apps

Specify list of package names to listen to notifications from those applications.

If packageNameList: null plugin will listen to notifications from all packages.

Reflex reflex = Reflex(
  debug: true,
  packageNameList: ["com.whatsapp", "com.facebook"],
);
Avoid notification from specific apps

Specify package name exception list to avoid listening notifications from those applications.

If packageNameExceptionList: null, the plugin will listen to notifications for packageNameList if not null.

Reflex reflex = Reflex(
  debug: true,
  packageNameExceptionList: ["com.whatsapp"],
);
Auto Reply

Send an automated reply while listening notification.

AutoReply autoReply = AutoReply(
  message: "[Reflex] This is an automated reply.",
),
Auto reply specific apps

Specify packageNameList in AutoReply to reply to specific applications.

AutoReply autoReply = AutoReply(
  packageNameList: ["com.whatsapp"],
  message: "[Reflex] This is an automated reply.",
),

The AutoReply object is used by the Reflex's autoReply field to automatically reply to applications.

Reflex reflex = Reflex(
  debug: true,
  packageNameList: ["com.whatsapp", "com.tyup"],
  packageNameExceptionList: ["com.miui.securitycenter"],
  autoReply: AutoReply(
    packageNameList: ["com.whatsapp"],
    message: "[Reflex] This is an automated reply.",
  ),
);

If the autoReply field is null in Reflex class, Auto reply feature will be disabled.

Ambiguity

A ReflexException will be thrown if,

  • Reflex's packageNameList and packageNameExceptionList contains any similar package name.

  • any package name in AutoReply's packageNameList is contained in Reflex's packageNameExceptionList.

Project Created & Maintained By

Divyanshu Shekhar

GitHub followers

Subham Praharaj

GitHub followers

Contributions

Contributions are welcomed!

If you feel that a hook is missing, feel free to open a pull-request.

For a custom-hook to be merged, you will need to do the following:

  • Describe the use-case.

  • Open an issue explaining why we need this hook, how to use it, ... This is important as a hook will not get merged if the hook doens't appeal to a large number of people.

  • If your hook is rejected, don't worry! A rejection doesn't mean that it won't be merged later in the future if more people shows an interest in it. In the mean-time, feel free to publish your hook as a package on https://pub.dev.

  • A hook will not be merged unles fully tested, to avoid breaking it inadvertendly in the future.

Stargazers

Stargazers repo roster for @DevsOnFlutter/reflex

Forkers

Forkers repo roster for @DevsOnFlutter/reflex

Copyright & License

Code and documentation Copyright (c) 2021 Divyanshu Shekhar. Code released under the BSD 3-Clause License.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.