Pakete, Repositories und App-Kategorien suchen

Cover von flutter_process_text
Paketdetailsv1.1.2

flutter_process_text

Flutter-Plugin zum Abonnieren des Prozess-Text-Streams zur kontinuierlichen Erfassung von Prozess-Text-Intention-Daten.

AndroidiOS
30-Tage-Downloads
60
Likes
35
Pub-Punkte
150

Paket installieren

flutter pub add flutter_process_text

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Ein Flutter-Plugin, das die Überwachung von Prozess-Textströmen ermöglicht und Anwendungen erlaubt, kontinuierliche Intent-Daten von externen Quellen zu empfangen. Es ist für Android und iOS konzipiert und erleichtert die nahtlose Integration in systemnahe Textverarbeitungsabläufe. Das Plugin erfasst Text-Intents in Echtzeit und eignet sich daher ideal für Anwendungsfälle wie die Überwachung der Zwischenablage, Textfreigabe oder die Integration mit dem Textoutput anderer Apps. Mit Fokus auf Einfachheit und plattformübergreifende Kompatibilität bietet es Entwicklern eine unkomplizierte API zum Zugriff auf eingehende Textströme.

Anwendungsfälle

  • Zwischenablageüberwachung
  • Textfreigabeanbindung
  • Echtzeit-Textverarbeitung
  • Textkommunikation zwischen Apps
  • Datenerfassung basierend auf Absicht

Hauptmerkmale

  • Echtzeit-Textstrom-Hörverbindung
  • Plattformübergreifende Unterstützung (Android & iOS)
  • Einfache API für Intent-Daten
  • Unterstützt kontinuierlichen Textfluss
  • Eingebaute Stream-Verarbeitung

Geeignet für

  • Entwickler, die Textfreigabeanwendungen erstellen
  • Apps, die eine Clipboard-Interaktion erfordern
  • intentionenbasierte Anwendungen
  • Plattformübergreifende Textverarbeitungstools
  • Plugins für Produktivität oder Automatisierung

Hinweise

  • Erforderliche Berechtigungen unter Android
  • Beschränkt auf Textabsichtsdaten nur
  • Kann die Einrichtung der Hintergrundausführung erfordern
  • Nicht geeignet für nicht-absichtliche Textquellen
  • iOS kann über eingeschränkte Hintergrundfunktionen verfügen

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

Flutter Process Text Plugin

Flutter_Process_Text

GitHub GitHub code size in bytes GitHub language count GitHub last commit

Compatibility

✅   Android
❌   iOS (active issue: iOS support)

Show some :heart: and :star: the repo

GitHub followers

Why use Flutter Process Text?

Flutter Process Text Plugin is known for :

Flutter Process Text Flutter Process Text
Fast, performant & compatible Free & Open-source
Production ready Make App Reactive

Features

✅   Listen process text stream
✅   Open app from process text intent activity
✅   Get pending intent text


Demo

App Running App Not Running
App Running AppNotRunning

Quick start

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

Run pub get and get packages.

Step 2: Create a new activity

Add the below code to your AndroidManifest.xml in the android\app\src\main\ folder.

  <activity 
        android:name=".ProcessTextActivity" 
        android:label="Process_Text"
        android:theme="@android:style/Theme.NoDisplay">
          <intent-filter>
              <action android:name="android.intent.action.PROCESS_TEXT" />
              <data android:mimeType="text/plain"/>
              <category android:name="android.intent.category.DEFAULT" />
          </intent-filter>
  </activity>

Note: You may change the android:name from ProcessTextActivity to anything you want. also change the android:label from Process_Text to the process action text that you want to display.

Step 3: Create new activity class

Create a new Java/Kotlin file with the same name as android:name in step 2.

Copy the below code and paste in the newly created file.

package com.divyanshushekhar.flutter_process_text_example;

import com.divyanshushekhar.flutter_process_text.FlutterProcessTextPlugin;
import io.flutter.embedding.android.FlutterActivity;
import android.os.Bundle;

public class ProcessTextActivity extends FlutterActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        boolean issAppRunning = MainActivity.getIsAppRunning();
        FlutterProcessTextPlugin.listenProcessTextIntent(issAppRunning);
    }
}

Note: Don't forget to change the package name in the above code.

Step 4: Changes in MainActivity

Make the necessary changes in the MainActivity class.

package com.divyanshushekhar.flutter_process_text_example;

import io.flutter.embedding.android.FlutterActivity;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Bundle;
import java.util.List;

public class MainActivity extends FlutterActivity {
   private static boolean isAppRunning;

   public static boolean getIsAppRunning() {
     return isAppRunning;
   }

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
        isAppRunning = isAppRunning(this);
   }

    public static boolean isAppRunning(Context context) {
        final String packageName = context.getPackageName();
        final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        final List<ActivityManager.RunningAppProcessInfo> processInfo = activityManager.getRunningAppProcesses();
        if (processInfo != null)
        {
            for (final ActivityManager.RunningAppProcessInfo info : processInfo) {
                if (info.processName.equals(packageName)) {
                    return true;
                }
            }
        }
        return false;
    }
}
Step 5: Connect to flutter

First thing you need to do is to call the initialize method from the FlutterProcessText class in the initState() {} of the page.

FlutterProcessText.initialize();

OR

FlutterProcessText.initialize(
    showConfirmationToast: true,
    showRefreshToast: true,
    showErrorToast: true,
    confirmationMessage: "Text Added",
    refreshMessage: "Got all Text",
    errorMessage: "Some Error",
);
Step 6: Working with stream

There are two ways to work with stream, either create a StreamSubscription to listen for the incoming data or store the Stream and use it in StreamBuilder.

  late final StreamSubscription _processText;
  String text? = '';

  @override
  void initState() {
    super.initState();
    FlutterProcessText.initialize(
      showToast: true,
      confirmationMessage: "Text Added",
      refreshMessage: "Got all Text",
      errorMessage: "Some Error",
    );

    _processText = FlutterProcessText.getProcessTextStream.listen((event) {
      setState(() {
        text = event;
      });
    });
  }

  @override
  void dispose() {
    super.dispose();
    _processText.cancel();
  }

OR

late final Stream<String> _processText;
_processText = FlutterProcessText.getProcessTextStream;

Now use the stream in the StreamBuilder.

StreamBuilder<String?>(
  stream: _processText,
  builder: (context, snapshot) {
    return Text('Fetched Data: ${snapshot.data}');
  },
),
Get pending data

Get the pending data by calling the refreshProcessText method in FlutterProcessText class.

String? text = await FlutterProcessText.refreshProcessText;

Project Created & Maintained By

Divyanshu Shekhar

Copyright & License

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

Kategorien

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.