firebase_in_app_messaging 0.1.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 92

firebase_in_app_messaging plugin #

A Flutter plugin to use the Firebase In-App Messaging API.

For Flutter plugins for other Firebase products, see README.md.

Usage #

Import the firebase_in_app_messaging plugin #

To use the firebase_in_app_messaging plugin, follow the plugin installation instructions.

Android integration #

There are a few extra steps required for the Android integration. Enable the Google services by configuring the Gradle scripts as such.

  1. Add the classpath to the [project]/android/build.gradle file.
dependencies {
  // Example existing classpath
  classpath 'com.android.tools.build:gradle:3.3.0'
  // Add the google services classpath
  classpath 'com.google.gms:google-services:4.3.0'
}
  1. Add the apply plugin to the [project]/android/app/build.gradle file.
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

Note: If this section is not completed you will get an error like this:

java.lang.IllegalStateException:
Default FirebaseApp is not initialized in this process [package name].
Make sure to call FirebaseApp.initializeApp(Context) first.

Note: When you are debugging on Android, use a device or AVD with Google Play services. Otherwise you will not be able to use Firebase In-App Messaging.

Use the plugin #

To show In-App Messages in your app, no extra setup is required - just import the plugin and you are good to go. However, to modify message behavior (as documented here), the plugin provides the following methods -

First off, add the following imports to your Dart code:

import 'package:firebase_in_app_messaging/firebase_in_app_messaging.dart';

Programmatic Triggers (docs)

To trigger in-app messages programmatically

FirebaseInAppMessaging.triggerEvent('eventName');

Temporarily disable in-app messages (docs)

If you'd like to suppress message displays for any reason, for example to avoid interrupting a sequence of payment processing screens, you can do that the following

FirebaseInAppMessaging.setMessagesSuppressed(true);


// To re-enable
FirebaseInAppMessaging.setMessagesSuppressed(false);

Enable opt-out message delivery (docs)

First, follow the step outlined here for both iOS and Android. Then add the following code in your app:

FirebaseInAppMessaging.setAutomaticDataCollectionEnabled(false);

Example #

See the example application source for a complete sample app using the Firebase In-App Messaging.

Issues and feedback #

Please file Flutterfire specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to Flutterfire can be filed in the Flutter issue tracker.

To contribute a change to this plugin, please review our contribution guide, and send a pull request.

0.1.1+1 #

  • Remove the deprecated author: field from pubspec.yaml
  • Migrate the plugin to the pubspec platforms manifest.
  • Bump the minimum Flutter version to 1.10.0.

0.1.1 #

  • Updated the plugin API to v2.

0.1.0 #

  • Updated README instructions for contributing for consistency with other Flutterfire plugins.

0.0.1+4 #

  • Update example app with correct const constructors.

0.0.1+3 #

  • Update AGP, gradle and inappmessaging-display versions on Android.

0.0.1+2 #

  • Remove dependency androidx.annotation:annotation:1.0.0.

0.0.1+1 #

  • Update google-services Android gradle plugin to 4.3.0 in documentation and examples.

0.0.1 #

  • Initial release.

example/README.md

firebase_in_app_messaging_example #

Demonstrates how to use the firebase_in_app_messaging plugin.

Use this package as a library

1. Depend on it

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


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

We analyzed this package on Dec 11, 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

Maintenance suggestions

The package description is too short. (-15 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.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
e2e ^0.2.1
flutter_driver
flutter_test
test any