Cryptocurrency Tracker docs
v2.0.0
Live demoConsole demo Get help
● Set up · FCM

Price alerts and push
checked on the server.

Price alerts are evaluated by the backend every 5 minutes, so they fire even when the app is closed. Push campaigns let you message everyone, Pro or free users.

Every 5 minutesFirebase Cloud Messaging9 languages

01How price alerts work

TypeFires when
Price aboveThe price (in the alert's currency) is at or above the target.
Price belowThe price is at or below the target.
Up by %The price is at least the target percentage above the price when the alert was created or re-armed.
Down by %The price is at least the target percentage below that price.
  • Repeat: once switches the alert off after it fires; daily keeps it on but fires at most once per 24 hours.
  • The scheduled function evaluateAlerts runs every 5 minutes, fetches current USD prices for every coin with an active alert, converts targets with the current fiat rates and sends the push to every device of the user. The notification text is in the device's language (server-side templates in 9 languages). Tapping it opens the coin.
  • Because the check runs every 5 minutes, a short price spike between two checks can be missed. Say so in your store listing if you promise alerts.
  • Alerts are created, re-armed and deleted through the API, never directly in Firestore. Push tokens that are no longer valid are deleted automatically.
  • How many active alerts a user may have is enforced by the server: free 3, Pro 100 by default (Console → Pro and purchases).

Source: firebase/functions/src/api/alerts.ts, docs/CONTRACT.md §3.15. The console's Alerts page shows active alerts by type and coin and the triggers of the last 7 days; Disable switches one off.

In the web demo

The demo has no Firebase. Alerts live in the browser and are checked when the page refreshes, shown as an in-app banner marked "Demo: on a phone this is a push notification".

02Set up Firebase Cloud Messaging

  1. AndroidNothing extra. flutterfire configure (Installation) registers the Android app; FCM works with it. On Android 13 and newer the app asks for the notification permission (POST_NOTIFICATIONS is declared in app/android/app/src/main/AndroidManifest.xml).
  2. iOS: APNs keySee below. Without it iOS devices receive no push.
  3. Deploy the backendevaluateAlerts and sendCampaigns are deployed with the other functions (Firebase backend).

The app registers its push token with the API (POST /v1/devices) and subscribes to the topic all plus pro or free according to the user's status (app/lib/services/push_service.dart).

03APNs key (iOS)

  1. Create the keyIn your Apple Developer account: Certificates, Identifiers & Profiles → Keys → +, enable Apple Push Notifications service (APNs), download the .p8 file and note the Key ID and your Team ID.
  2. Upload it to FirebaseFirebase console → Project settings → Cloud Messaging → your iOS app → APNs Authentication Key → Upload, with the Key ID and Team ID.
  3. Capability in XcodeThe Runner target already has the Push Notifications entitlement (aps-environment in app/ios/Runner/Runner.entitlements) and the remote-notification background mode (app/ios/Runner/Info.plist). After you change the bundle id, check both under Signing & Capabilities.
Keep the .p8 file private

It is a signing key for your Apple account. Never put it in the app, in git or in a support message.

04Push campaigns

Console → Push campaigns: write a title and message, pick the segment (all, Pro or free users), optionally a coin to open when tapped, and a time, or press Send now. You can cancel a campaign while it is scheduled.

The console never sends a message itself. It stores the campaign; the backend's sendCampaigns job (every 5 minutes) sends due campaigns to the FCM topic of the segment and records sent or failed. So "Send now" goes out within about 5 minutes.

Store rules for promotional push

Apple and Google restrict marketing notifications. Do not use push for advertising without the user's consent, and never send investment tips or price predictions.