push 3.3.3

SDKflutter
Platformandroidiosmacos

Push notifications in Flutter without firebase_messaging for Android, iOS and macOS.

Tools for push notifications

Setup

  • Install Node
  • Install pnpm: npm install --global pnpm
  • Install dependencies: pnpm install
  • Switch to tool directory: cd tool/
  • Create config.yaml and update it according to the comments in the file: cp example.config.yaml config.yaml

Usage

  • Set up example app
  • Connect a device or launch an iOS/Android emulator/simulator: flutter emulators and flutter emulators --launch $
    • skip this step for macOS
  • get a device id from the output of flutter devices
    • skip this step for macOS
  • Run your app: flutter run -d $device_id
    • on macOS, run flutter run -d macos
  • Get the device token from the Flutter output or your app, and update config.yaml

Run pnpm start. For example, run

  • pnpm start to send to all devices
  • pnpm start [--android] [--macos] [--ios], e.g. pnpm start --ios to send to specific platforms

For more information, run pnpm start --help

Known issues

  • iOS Simulators don't seem to support background message on simulators (when app is in foreground or background). A real device will be more realistic/helpful (less confusing).
  • We can't use bun or node's built-in fetch for connecting to APNs, because they don't support HTTP/2. See https://github.com/oven-sh/bun/issues/7194. We use fetch-h2 to support HTTP/2

Resources