icapps_notifications 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

Flutter icapps Notifications #

This plugin will be used to handle all cases for push notifications by the icapps standard.

THIS PACKAGE HAS NO SUPPORT FOR THE ICAPPS IPNS

What is supported? #

App in ForegroundApp in BackgroundApp Terminated
Notification on AndroidonMessageNotification is delivered to system tray.Notification is delivered to system tray.
Notification on iOSonMessageNotification is delivered to system tray.Notification is delivered to system tray.
Data Message on AndroidonMessagetilte, body is supported to show a notification. Otherwise you have to create a new android service to handle this casetilte, body is supported to show a notification. Otherwise you have to create a new android service to handle this case
Data Message on iOSonMessageMessage is stored by FCM and delivered to app via onMessage when the app is brought back to foreground.Message is stored by FCM and delivered to app via onMessage when the app is brought back to foreground.

What should you use #

iOS #

NOTIFICATION should be used for everything

Android #

DATA should be used to handle everything

Get started #

https://medium.com/flutterpub/enabling-firebase-cloud-messaging-push-notifications-with-flutter-39b08f2ed723

Warning -> DO NOT SET FirebaseAppDelegateProxyEnabled to NO

Dart API #

Configure #

configure(onMessage, dismissIOSBadgeOnStartup = true)

Token #

getToken()

Delete Instance ID #

deletes your token from fcm.

deleteInstanceID()

requestNotificationPermissions (iOS) #

request permission for push notifications.

requestNotificationPermissions()

setBadge (iOS) #

set your badge whenever you want on iOS

setBadge(amount)

Example project #

If you want to run this example project you will need to add the google-services.json and plist to your android and ios project

Questions? #

contact koen.vanlooveren@icapps.com

Changelog #

[0.1.0] - 2019-06-27

Fix #

-Fixed some warnings

[0.0.1] - 2019-06-27

Added #

-Initial release

example/README.md

icapps_notifications_example #

Demonstrates how to use the icapps_notificationsplugin.

import 'package:flutter/material.dart';
import 'package:icapps_notifications/icapps_notifications.dart';

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final _firebaseMessaging = FirebaseMessaging();

  String _content = "";
  String _token = "";

  @override
  void initState() {
    super.initState();
    _firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        setState(() {
          _content = message.toString();
          print(_content);
        });
      },
      dismissIOSBadgeOnStartup: true,
    );
    _firebaseMessaging.requestNotificationPermissions(const IosNotificationSettings(sound: true, badge: true, alert: true));
    _firebaseMessaging.onIosSettingsRegistered.listen((IosNotificationSettings settings) {
      print("Settings registered: $settings");
      _getToken();
    });
    _getToken();
  }

  Future<void> _getToken() async {
    final token = await _firebaseMessaging.getToken();
    assert(token != null);
    setState(() {
      _token = "Push Messaging token: $token";
      print(token);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Example icapps Push Notifications'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          children: [
            Text(_token),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8),
              child: Container(
                height: 1,
                color: Colors.grey,
              ),
            ),
            Text(_content),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  icapps_notifications: ^0.1.0

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:icapps_notifications/icapps_notifications.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
19
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
meta ^1.0.7 1.1.7
platform ^2.0.0 2.2.1
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
firebase_core ^0.4.0
flutter_test
mockito ^3.0.0
test ^1.3.0