Skip to content

Sample project demonstrating how to integrate OneSignal into a Flutter project.

Notifications You must be signed in to change notification settings

OneSignalDevelopers/OneSignal-Flutter-Sample

Repository files navigation

OneSignal Flutter Integreation

This repo contains a sample project integrating the OneSignal Flutter SDK into a starter Flutter targeting for Android and iOS.

Getting Started

There are quite a few moving pieces to get this sample to work due to the nature of Flutter and the platforms it targets.

Configuring OneSignal

  1. Setup a OneSignal account if you don't already have one.
  2. Use the OneSignal Dashboard to create a new app.
  3. Configure the platform you'd like to target...

Configuring Android

I recommend starting with Android first.

  1. Create a new Firebase project
  2. Select your app in the OneSignal dashboard.
  3. Enter your Firebase info.
  4. Select Flutter as your SDK.

Configuring iOS

  1. Obtain an Apple push certficate
  2. Select your app in the OneSignal dashboard.
  3. Navigate to settings.
  4. Find and select iOS in the platform list.
  5. Upload your certificate (*.p12).
  6. Enter the passphrase you encrypted your certificate with.
  7. Select Flutter as your SDK.

Configuring Flutter project

Update bundle identifier

Open the project in Android Studio or VS Code.

  1. Find all occurrences of, com.example.onesignal_and_flutter
  2. Replace all occurrences with the unique bunlde identifier you used in setting up iOS.
    • If you're deploying to Android only, replace the com.example bit of the identifier with something unique to you.

Starting app

  1. Install Flutter dependencies, flutter pub get
  2. Install iOS dependendies. From ios directory, pod install (required if targeting iOS)
  3. Start the project. From project root, flutter run

Community

OneSignal has a growing community of excited developers and integrators. You can join us on Discord and follow us on Twitter.

Beta Program

The OneSignal Beta Program is a diverse group of users and companies who participate in our feature development process. Beta members help shape the future of OneSignal products by providing feedback, sharing ideas, and testing out new features before they're released.