diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..4deb66c
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,13 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "vortifier_app",
+ "request": "launch",
+ "type": "dart"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/android/app/build.gradle b/android/app/build.gradle
index cff5e97..deb7bf0 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.vortifier_app"
- minSdkVersion 16
+ minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index cea0db5..f958c15 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -26,5 +26,12 @@
+
+
+
+
+
diff --git a/lib/main.dart b/lib/main.dart
index 3ea0104..66deaf0 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,111 +1,71 @@
import 'package:flutter/material.dart';
+import 'dart:async';
+import 'dart:convert';
+
+import 'package:android_notification_listener2/android_notification_listener2.dart';
void main() => runApp(MyApp());
-class MyApp extends StatelessWidget {
- // This widget is the root of your application.
+class MyApp extends StatefulWidget {
@override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- // This is the theme of your application.
- //
- // Try running your application with "flutter run". You'll see the
- // application has a blue toolbar. Then, without quitting the app, try
- // changing the primarySwatch below to Colors.green and then invoke
- // "hot reload" (press "r" in the console where you ran "flutter run",
- // or simply save your changes to "hot reload" in a Flutter IDE).
- // Notice that the counter didn't reset back to zero; the application
- // is not restarted.
- primarySwatch: Colors.blue,
- ),
- home: MyHomePage(title: 'Flutter Demo Home Page'),
- );
- }
+ _MyAppState createState() => _MyAppState();
}
-class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
+class _MyAppState extends State {
+ AndroidNotificationListener _notifications;
+ StreamSubscription _subscription;
- // This widget is the home page of your application. It is stateful, meaning
- // that it has a State object (defined below) that contains fields that affect
- // how it looks.
+ @override
+ void initState() {
+ super.initState();
+ initPlatformState();
+ }
- // This class is the configuration for the state. It holds the values (in this
- // case the title) provided by the parent (in this case the App widget) and
- // used by the build method of the State. Fields in a Widget subclass are
- // always marked "final".
+ // Platform messages are asynchronous, so we initialize in an async method.
+ Future initPlatformState() async {
+ startListening();
+ }
- final String title;
+ void onData(NotificationEventV2 event) {
+// const _packageToSearch = 'com.nianticproject.ingress';
+// const _packageToSearch = 'com.enlnf';
+ const _packageToSearch = 'org.kman.AquaMail';
- @override
- _MyHomePageState createState() => _MyHomePageState();
-}
+ print(event);
+ print(event.packageName);
+
+ if (event.packageName == _packageToSearch) {
+ print('INGRESS Notification');
+ print('INGRESS Notification');
+ print('INGRESS Notification');
+ }
+
+ print('converting package extra to json');
+ var jsonDatax = json.decode(event.packageExtra);
+ print(jsonDatax);
+ }
-class _MyHomePageState extends State {
- int _counter = 0;
+ void startListening() {
+ _notifications = new AndroidNotificationListener();
+ try {
+ _subscription = _notifications.notificationStream.listen(onData);
+ } on NotificationExceptionV2 catch (exception) {
+ print(exception);
+ }
+ }
- void _incrementCounter() {
- setState(() {
- // This call to setState tells the Flutter framework that something has
- // changed in this State, which causes it to rerun the build method below
- // so that the display can reflect the updated values. If we changed
- // _counter without calling setState(), then the build method would not be
- // called again, and so nothing would appear to happen.
- _counter++;
- });
+ void stopListening() {
+ _subscription.cancel();
}
@override
Widget build(BuildContext context) {
- // This method is rerun every time setState is called, for instance as done
- // by the _incrementCounter method above.
- //
- // The Flutter framework has been optimized to make rerunning build methods
- // fast, so that you can just rebuild anything that needs updating rather
- // than having to individually change instances of widgets.
- return Scaffold(
- appBar: AppBar(
- // Here we take the value from the MyHomePage object that was created by
- // the App.build method, and use it to set our appbar title.
- title: Text(widget.title),
- ),
- body: Center(
- // Center is a layout widget. It takes a single child and positions it
- // in the middle of the parent.
- child: Column(
- // Column is also a layout widget. It takes a list of children and
- // arranges them vertically. By default, it sizes itself to fit its
- // children horizontally, and tries to be as tall as its parent.
- //
- // Invoke "debug painting" (press "p" in the console, choose the
- // "Toggle Debug Paint" action from the Flutter Inspector in Android
- // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
- // to see the wireframe for each widget.
- //
- // Column has various properties to control how it sizes itself and
- // how it positions its children. Here we use mainAxisAlignment to
- // center the children vertically; the main axis here is the vertical
- // axis because Columns are vertical (the cross axis would be
- // horizontal).
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'You have pushed the button this many times:',
- ),
- Text(
- '$_counter',
- style: Theme.of(context).textTheme.headline4,
- ),
- ],
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
+ title: const Text('Plugin example app'),
),
),
- floatingActionButton: FloatingActionButton(
- onPressed: _incrementCounter,
- tooltip: 'Increment',
- child: Icon(Icons.add),
- ), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
diff --git a/lib/notification_listen.dart b/lib/notification_listen.dart
new file mode 100644
index 0000000..c9055df
--- /dev/null
+++ b/lib/notification_listen.dart
@@ -0,0 +1,8 @@
+import 'package:flutter/material.dart';
+
+class NotifiyListen extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return Container();
+ }
+}
diff --git a/pubspec.lock b/pubspec.lock
index fcf6763..58af2ed 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1,62 +1,55 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
- archive:
- dependency: transitive
- description:
- name: archive
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.11"
- args:
- dependency: transitive
+ android_notification_listener2:
+ dependency: "direct main"
description:
- name: args
+ name: android_notification_listener2
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.2"
+ version: "2.0.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.4.0"
+ version: "2.4.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.5"
- charcode:
+ version: "2.0.0"
+ characters:
dependency: transitive
description:
- name: charcode
+ name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.2"
- collection:
+ version: "1.0.0"
+ charcode:
dependency: transitive
description:
- name: collection
+ name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.11"
- convert:
+ version: "1.1.3"
+ clock:
dependency: transitive
description:
- name: convert
+ name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.1"
- crypto:
+ version: "1.0.1"
+ collection:
dependency: transitive
description:
- name: crypto
+ name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.3"
+ version: "1.14.13"
cupertino_icons:
dependency: "direct main"
description:
@@ -64,6 +57,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
+ fake_async:
+ dependency: transitive
+ description:
+ name: fake_async
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@@ -74,20 +74,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
- image:
- dependency: transitive
- description:
- name: image
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.6"
+ version: "0.12.8"
meta:
dependency: transitive
description:
@@ -101,28 +94,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.4"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.8.0+1"
- petitparser:
- dependency: transitive
- description:
- name: petitparser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.4.0"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.5"
+ version: "1.7.0"
sky_engine:
dependency: transitive
description: flutter
@@ -134,14 +106,14 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.5"
+ version: "1.7.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.3"
+ version: "1.9.5"
stream_channel:
dependency: transitive
description:
@@ -169,14 +141,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.11"
+ version: "0.2.17"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.6"
+ version: "1.2.0"
vector_math:
dependency: transitive
description:
@@ -184,12 +156,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
- xml:
- dependency: transitive
- description:
- name: xml
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.5.0"
sdks:
- dart: ">=2.4.0 <3.0.0"
+ dart: ">=2.9.0-14.0.dev <3.0.0"
+ flutter: ">=1.10.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 98e5be2..0553156 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -20,6 +20,9 @@ dependencies:
flutter:
sdk: flutter
+ # Notiffictions
+ android_notification_listener2: ^2.0.1
+
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2