| @@ -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" | |||||
| } | |||||
| ] | |||||
| } | |||||
| @@ -39,7 +39,7 @@ android { | |||||
| defaultConfig { | defaultConfig { | ||||
| // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||||
| applicationId "com.example.vortifier_app" | applicationId "com.example.vortifier_app" | ||||
| minSdkVersion 16 | |||||
| minSdkVersion 21 | |||||
| targetSdkVersion 28 | targetSdkVersion 28 | ||||
| versionCode flutterVersionCode.toInteger() | versionCode flutterVersionCode.toInteger() | ||||
| versionName flutterVersionName | versionName flutterVersionName | ||||
| @@ -26,5 +26,12 @@ | |||||
| <meta-data | <meta-data | ||||
| android:name="flutterEmbedding" | android:name="flutterEmbedding" | ||||
| android:value="2" /> | android:value="2" /> | ||||
| <service android:name="com.emilecode.android_notification_listener2.NotificationListener" | |||||
| android:label="notifications" | |||||
| android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> | |||||
| <intent-filter> | |||||
| <action android:name="android.service.notification.NotificationListenerService" /> | |||||
| </intent-filter> | |||||
| </service> | |||||
| </application> | </application> | ||||
| </manifest> | </manifest> | ||||
| @@ -1,111 +1,71 @@ | |||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'dart:async'; | |||||
| import 'dart:convert'; | |||||
| import 'package:android_notification_listener2/android_notification_listener2.dart'; | |||||
| void main() => runApp(MyApp()); | void main() => runApp(MyApp()); | ||||
| class MyApp extends StatelessWidget { | |||||
| // This widget is the root of your application. | |||||
| class MyApp extends StatefulWidget { | |||||
| @override | @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<MyApp> { | |||||
| AndroidNotificationListener _notifications; | |||||
| StreamSubscription<NotificationEventV2> _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<void> 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<MyHomePage> { | |||||
| 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 | @override | ||||
| Widget build(BuildContext context) { | 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: <Widget>[ | |||||
| 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. | |||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,8 @@ | |||||
| import 'package:flutter/material.dart'; | |||||
| class NotifiyListen extends StatelessWidget { | |||||
| @override | |||||
| Widget build(BuildContext context) { | |||||
| return Container(); | |||||
| } | |||||
| } | |||||
| @@ -1,62 +1,55 @@ | |||||
| # Generated by pub | # Generated by pub | ||||
| # See https://dart.dev/tools/pub/glossary#lockfile | # See https://dart.dev/tools/pub/glossary#lockfile | ||||
| packages: | 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: | description: | ||||
| name: args | |||||
| name: android_notification_listener2 | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.5.2" | |||||
| version: "2.0.1" | |||||
| async: | async: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: async | name: async | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.4.0" | |||||
| version: "2.4.2" | |||||
| boolean_selector: | boolean_selector: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: boolean_selector | name: boolean_selector | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.0.5" | |||||
| charcode: | |||||
| version: "2.0.0" | |||||
| characters: | |||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: charcode | |||||
| name: characters | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.1.2" | |||||
| collection: | |||||
| version: "1.0.0" | |||||
| charcode: | |||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: collection | |||||
| name: charcode | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.14.11" | |||||
| convert: | |||||
| version: "1.1.3" | |||||
| clock: | |||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: convert | |||||
| name: clock | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.1" | |||||
| crypto: | |||||
| version: "1.0.1" | |||||
| collection: | |||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: crypto | |||||
| name: collection | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.3" | |||||
| version: "1.14.13" | |||||
| cupertino_icons: | cupertino_icons: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| @@ -64,6 +57,13 @@ packages: | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.1.3" | version: "0.1.3" | ||||
| fake_async: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: fake_async | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "1.1.0" | |||||
| flutter: | flutter: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: flutter | description: flutter | ||||
| @@ -74,20 +74,13 @@ packages: | |||||
| description: flutter | description: flutter | ||||
| source: sdk | source: sdk | ||||
| version: "0.0.0" | version: "0.0.0" | ||||
| image: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: image | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "2.1.4" | |||||
| matcher: | matcher: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: matcher | name: matcher | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.12.6" | |||||
| version: "0.12.8" | |||||
| meta: | meta: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| @@ -101,28 +94,7 @@ packages: | |||||
| name: path | name: path | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | 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: | sky_engine: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: flutter | description: flutter | ||||
| @@ -134,14 +106,14 @@ packages: | |||||
| name: source_span | name: source_span | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.5.5" | |||||
| version: "1.7.0" | |||||
| stack_trace: | stack_trace: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: stack_trace | name: stack_trace | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.9.3" | |||||
| version: "1.9.5" | |||||
| stream_channel: | stream_channel: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| @@ -169,14 +141,14 @@ packages: | |||||
| name: test_api | name: test_api | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.2.11" | |||||
| version: "0.2.17" | |||||
| typed_data: | typed_data: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| name: typed_data | name: typed_data | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.1.6" | |||||
| version: "1.2.0" | |||||
| vector_math: | vector_math: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| @@ -184,12 +156,6 @@ packages: | |||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.0.8" | version: "2.0.8" | ||||
| xml: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: xml | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "3.5.0" | |||||
| sdks: | sdks: | ||||
| dart: ">=2.4.0 <3.0.0" | |||||
| dart: ">=2.9.0-14.0.dev <3.0.0" | |||||
| flutter: ">=1.10.0" | |||||
| @@ -20,6 +20,9 @@ dependencies: | |||||
| flutter: | flutter: | ||||
| sdk: flutter | sdk: flutter | ||||
| # Notiffictions | |||||
| android_notification_listener2: ^2.0.1 | |||||
| # The following adds the Cupertino Icons font to your application. | # The following adds the Cupertino Icons font to your application. | ||||
| # Use with the CupertinoIcons class for iOS style icons. | # Use with the CupertinoIcons class for iOS style icons. | ||||
| cupertino_icons: ^0.1.2 | cupertino_icons: ^0.1.2 | ||||