notification_reactor 0.0.3+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

notification_reactor pub package

For DIY engineers! Define your own reaction by Push Notification (via APNs (iOS) / FirebaseCloudMessaging (Android)).

Getting Started #

Android Integration #

To integrate your plugin into the Android part of your app, setup Firebase:

  1. Using the Firebase Console add an Android app to your project: Follow the assistant, download the generated google-services.json file and place it inside android/app.
  2. Modify the android/build.gradle file and the android/app/build.gradle file to add the Google services plugin as described by the Firebase assistant.
  3. Implement your original FirebaseMessagingService in Java/Kotlin. Recommending to create your NotificationCompat using support-compat. When you make Notification with PendingIntent, you should contains RemoteMessage object you received with key "EXTRA_PUSH_MESSAGE".
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    Intent launchApp = new Intent();
    launchApp.putExtra("EXTRA_PUSH_MESSAGE", remoteMessage);
    launchApp.setClass(this, MainActivity.class);
    PendingIntent onTapNotification = PendingIntent.getActivity(this, 0, launchApp, PendingIntent.FLAG_ONE_SHOT);

    ...

    NotificationBuilder builder = (new NotificationCompat.Builder(...))
            .setContentIntent(onTapNotification);

    ...
}

(Please see this tutorial if you want.)

iOS Integration #

To integrate your plugin into the iOS part of your app, follow these steps:

  1. Generate the certificates from Apple developer center for receiving push notifications. (Please see this article if you want the tutorial.)
  2. Enable Push Notification in Capabilities tab in Xcode opening your ios/Runner.xcworkspace.

Enabling Push Notification switch

Dart/Flutter Integration #

From your Dart code, you need to import the plugin and instantiate it:

import 'package:notification_reactor/notification_reactor.dart';

final reactor = NotificationReactor();

To set handler for Push Notifications, call setHandlers() :

reactor.setHandlers(
  onLaunch: (Map<String, dynamic> message) { /* Called when your app launched by PushNotifications */ },
  onResume: (Map<String, dynamic> message) { /* Called when your app become foreground from background by PushNotifications */ },
  onMessage: (Map<String, dynamic> message) { /* Called when receive PushNotifications during your app is on foreground */ },
);

... and send pushes from your server!

When you send pushes, you need APNs/FCM push token. To get token, recommending to use plain_notification_token.

0.0.3+1 #

  • Fix timing of removing notification badge on iOS

0.0.3 #

  • Now badge on app icon will disappear when app become active on iOS.

0.0.2 #

  • Remove method for developing

0.0.1 #

  • First release

example/README.md

notification_reacter_example #

Demonstrates how to use the notification_reacter plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  notification_reactor: ^0.0.3+1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:notification_reactor/notification_reactor.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Dec 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.4

Health issues and suggestions

Document public APIs. (-1 points)

6 out of 6 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/notification_reactor.dart.

Run flutter format to format lib/notification_reactor.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
meta ^1.1.6 1.1.8
Transitive dependencies
collection 1.14.11 1.14.12
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
mockito ^4.1.0