Code Monkey home page Code Monkey logo

androidnotificationlistener's Introduction

Android Notification Listener ( V2 )

Note: This pluggin is a Fix for the original one which is depracated, please use this one instead

This plugin ( only availaible on Android due to iOS restrictions ) will allow you to listen to any incoming notifications on an Android device running on Android APi level 21 or more . In another word you can read notifications coming from all the installed applications with deep details

Note: This pluggin is a Fork of the original plugin made by Cachet which has some bugs causing frequent crashes and is missing features and details, so I fixed it and added more features :)

Features

Here are the details you will get from a notification

  • The time Stamp
  • The package name
  • The package message
  • The package text
  • The package extra

Note: The PackageExtra contains more details about each individual notification. It is originally a bundle file. I converted it into a Json and give it to you as a Json String so if you need to use the PackageExtra you will have to json decode it as follow

var jsonDatax = json.decode(event.packageExtra);
print(jsonDatax);

You can refer the example folder for more detail

Here are the extra data you will get from the PackageExtra

  • android.title
  • android.reduced.images
  • android.template
  • android.text
  • android.foregroundApps
  • android.bigText

Android Setup

Register a service in the Android Manifest

The plugin uses an Android system service to track notifications. To allow this service to run on your application, the following code should be put inside the Android manifest, between the tags.

<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>

Listen to notification events

AndroidNotificationListener _notifications;
StreamSubscription<NotificationEventV2> _subscription;
subscription = _notifications.notificationStream.listen(onData);

Where the onData() method handles the incoming NotificationEventV2. An example could be:

void onData(NotificationEventV2 event) => print(event.toString());

Conclusion

Thank you for using my package, if you have any question feel free to contact me on instagram or directly on my mail [email protected]

Here are my other packages

  • Ultimate Data Generator: generate realistic datas
  • Sliding Card: Animated card that slides down to reveal its hidden part
  • AdvFab: An Advanced floating action button that expands itself to reveal its hidden widget. It can also be used as an AnimatedbottomNavigationbar or just an AnimatedFloatingActionBar with the same expansion capabilities.

androidnotificationlistener's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.