Early access · launching soon. Request access

Early access

Early access · launching soon
Product
IntelligenceEarly access. Designed and in development. No results yet. See what's left on the roadmap.
Developers
Resources
Request access

A person reads every request.

Developers · Flutter SDK

Flutter push notifications SDK

One plugin, oricato_push, for Android and iOS. It is built on firebase_messaging, uses flutter_local_notifications to render Android data messages, even from the background isolate, and reports deliveries, opens and conversions through a stored retry queue.

oricato_push 1.0.1Flutter 3.27+Dart 3.6+firebase_core 3.12–4.xfirebase_messaging 15.2–16.xflutter_local_notifications 18–19.xAndroid minSdk 21iOS 13+

Last updated · Ask the docs, or a person

What the Flutter SDK does with one push Sample data. Illustrative numbers, not from a real app.
A person holding a phone at a café table over lunch in Berlin
1:00PM · Berlin Deutsch

Lingora jetzt

Deine Lektion für heute ist bereit

Fünf Minuten, und deine 12-Tage-Serie hält.

receiptsFlutter

  1. pushfx_id 0192f0c4… · fx_v 113:00:00
  2. shownchannel lessons · big picture13:00:01
  3. deliveredsampled device · once13:00:03
  4. openedtap · launch_url lingora://lesson13:00:41

A photo of a phone in someone's hands; on its screen, a sample notification from Lingora in the language de. Beside it, the receipts the SDK reports for that push: shown, delivered from a sampled device, and opened on tap.

01

What the plugin does for you

  • Creates and keeps the subscription ID in native storage that is never backed up, with a guard against restored or copied state.
  • Registers and updates the subscription on start, resume, token refresh, time zone or locale change, permission change and every setter, when something changed or the last success is over an hour old.
  • Sends the IANA time zone, the language your app shows, country hints, device model, OS, app and SDK versions, and the permission state.
  • Creates Android notification channels from your dashboard settings.
  • Renders Android data messages with channel, icon, accent color, big picture, group and collapse key, and handles taps, including the tap that started the app.
  • Reports delivered from sampled devices, opened and conversions, with de-duplication, backoff, Retry-After and an Android WorkManager job to flush the queue.

02

Add the package

Your app must already be set up for Firebase Cloud Messaging (flutterfire configure, google-services.json, GoogleService-Info.plist). During early access the plugin comes in the SDK kit with your account. Copy it into your repository and use a path dependency.

YAML

pubspec.yaml

dependencies:
  firebase_core: ^4.11.0
  firebase_messaging: ^16.4.1
  oricato_push:
    path: packages/oricato_push

03

Android setup

  1. Core library desugaring, which flutter_local_notifications needs, in android/app/build.gradle.kts:
    Kotlin
    android {
        compileOptions {
            isCoreLibraryDesugaringEnabled = true
        }
    }
    dependencies {
        coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
    }
  2. A small icon, white on transparent, for example res/drawable/ic_stat_notification.png in every density, passed as defaultSmallIcon. Unknown icon names fall back to it, then to the app icon.
  3. Keep resources referenced by name with android/app/src/main/res/raw/oricato_keep.xml:
    XML
    <?xml version="1.0" encoding="utf-8"?>
    <resources xmlns:tools="http://schemas.android.com/tools"
        tools:keep="@drawable/ic_stat_*,@raw/*" />
  4. Channel sounds go in res/raw/, for example chime.mp3, named chime in the dashboard. A channel whose sound is missing is not created, because Android fixes a channel's sound when it is created.
  5. Permission. The plugin declares POST_NOTIFICATIONS. On Android 13 and later, call Oricato.requestPermission() at a good moment in onboarding.
  6. Deep links open with ACTION_VIEW. Keep launchMode="singleTop" on MainActivity, the Flutter default, and handle links in your router.

04

iOS setup

  1. In Xcode, under Signing & Capabilities, add Push Notifications and Background Modes › Remote notifications. Upload your APNs key (.p8) in the Firebase console.
  2. Foreground presentation follows firebase_messaging:
    Dart
    await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
      alert: true, badge: true, sound: true,
    );
  3. Optional: the Notification Service Extension, for images and for deliveries while the app isn't running. Open ios/Runner.xcworkspace, add a Notification Service Extension target, link OricatoPushNotificationService from the iOS package in the kit, subclass OricatoNotificationService, and set OricatoApiBaseURL in the extension's Info.plist. Then call Oricato.setDeliveryReportedByExtension(true) in Dart.

Build fails with "Cycle inside Runner"? Move Runner's Embed Foundation Extensions build phase above Run Script and Thin Binary. Without an extension, iOS reports delivered only for pushes that arrive while the app is in the foreground; opens are always reported.

The extension, in detail

05

Initialize and wire the background handler

The background handler must be a top-level function marked @pragma('vm:entry-point'). If you already have one, call Oricato.handleBackgroundMessage from it; it returns true for Oricato pushes.

Dart

main.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:oricato_push/oricato_push.dart';

import 'firebase_options.dart';

@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  // Renders Android data messages and records "delivered".
  // Works without Oricato.initialize in this isolate.
  if (await Oricato.handleBackgroundMessage(message)) return;
  // your own background handling for other pushes
}

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);

  await Oricato.initialize(
    '<ORICATO_PROJECT_ID>',
    '<ORICATO_API_ADDRESS>',
    options: const OricatoInitOptions(defaultSmallIcon: 'ic_stat_notification'),
  );

  Oricato.onNotificationOpened((n) {
    // n.messageId, n.title, n.body, n.launchUrl, n.additionalData
  });

  runApp(const MyApp());
}

initialize returns after local setup and registers in the background. Call it on every start. No handler of your own? Pass oricatoFirebaseMessagingBackgroundHandler instead.

06

Report the language your app shows

Oricato picks each message's translation from the subscriber's language. Report the locale your UI uses, for example from your root widget. Without it, the device locale is used.

Dart
@override
void didChangeDependencies() {
  super.didChangeDependencies();
  Oricato.setLanguage(Localizations.localeOf(context).toLanguageTag());
}

07

API

CallNotes
Oricato.initialize(projectId, apiBaseUrl, {options})Idempotent; stores the settings; first registration in the background.
Oricato.setLanguage(code)Normalized (zh-TW becomes zh-hant); null follows the app locale.
Oricato.setExternalUserId(id, {hash})An opaque, pseudonymous ID only, never an email or phone number.
Oricato.setTags(map)Merges; a null or empty value removes the key. Up to 50 keys.
Oricato.optIn() / optOut()App-level switch.
Oricato.trackEvent(name)A conversion; linked by the server to the latest open within 24 hours.
Oricato.onNotificationOpened(handler) / notificationOpened streamThe latest unhandled tap, up to five minutes old, arrives when you register.
Oricato.onForegroundNotification(handler) / foregroundNotifications streamReturn false to hide the Android notification.
Oricato.getSubscriptionId()The stored ID. Show it in a debug screen to set up a test device.
Oricato.requestPermission({provisional}) / getPermissionStatus()Android 13 and later, and iOS authorization.
Oricato.setLaunchUrlsAutoOpen(bool)On by default.
Oricato.setAppCheckTokenProvider(...)Adds the App Check header, cached until five minutes before expiry.
Oricato.setLogLevel(level) / setLogSink(sink)Never logs secrets.
Oricato.setDeliveryReportedByExtension(bool)iOS with the extension.
Oricato.handleBackgroundMessage(message)From your own background handler.

08

Apps that already own firebase_messaging or flutter_local_notifications

By default Oricato listens to onMessage and onMessageOpenedApp, calls getInitialMessage() and initializes flutter_local_notifications on Android. getInitialMessage() returns a message only once, and flutter_local_notifications has a single tap callback. If your app uses them itself, for example for locally scheduled reminders, turn those parts off and forward.

Dart
await Oricato.initialize(projectId, apiBaseUrl,
  options: const OricatoInitOptions(
    handleFirebaseMessaging: false,
    manageLocalNotifications: false,
    defaultSmallIcon: 'ic_stat_notification',
  ),
);

FirebaseMessaging.onMessage.listen((m) async {
  if (await Oricato.handleForegroundMessage(m)) return;
  // your foreground handling
});
FirebaseMessaging.onMessageOpenedApp.listen((m) async {
  if (await Oricato.handleMessageOpenedApp(m)) return;
});
final initial = await FirebaseMessaging.instance.getInitialMessage();
if (!await Oricato.handleInitialMessage(initial)) {
  // your cold-start handling
}

Forward taps from flutter_local_notifications with Oricato.handleNotificationResponse and launch details with Oricato.handleLaunchDetails; each returns true when the notification was Oricato's.

09

Running next to onesignal_flutter

  1. Keep onesignal_flutter and add oricato_push. Each SDK gets its own Firebase registration and handles only its own pushes; notification channels don't collide.
  2. Ask for notification permission once, with either SDK.
  3. Optional: from this release, set a OneSignal tag such as oricato = 1 and exclude it from OneSignal sends, so only phones that haven't updated still get OneSignal pushes.
  4. On a real iPhone, check that tapping an Oricato notification reaches onNotificationOpened and OneSignal notifications still open as before.

The full migration reference

Oricato Intelligence · Early access

One more release, later

Designed and in development. No results yet.

Oricato Intelligence (early access) will need a later plugin version that counts app opens a notification did not start, inside the registration you already send, plus a consent switch your app sets. In the EEA and the UK it stays off until your app asks.

How Intelligence works

Early access · launching soon

One plugin, both stores.

Request access and we'll set up your dedicated account and hand you the SDK kit. Founding teams get early access and a founding discount, and free help if onesignal_flutter is in your pubspec today.

We use this to reply, plan your invitation and set up your account. Privacy Policy

A person reads every request.

Or get the monthly newsletter