Quick start
Get started with the Pushwoosh Flutter SDK using this quick and simple example
Prerequisites
To integrate the Pushwoosh Flutter SDK into your app, you will need the following:
Download the example project
# Clone the SDK repository and navigate to the example projectgit clone https://github.com/Pushwoosh/pushwoosh-flutter
# Navigate to example directorycd pushwoosh-flutter/Source/pushwoosh/example
Configure the project
Install the dependencies:
flutter pub get
Open lib/main.dart and update the Pushwoosh.initialize call:
Pushwoosh.initialize({"app_id": "XXXXX-XXXXX", "sender_id": "XXXXXXXXXXXX"});
Replace the app_id
and sender_id
values with your Pushwoosh App Code and Firebase Project Number.
iOS
1. Install dependencies
Navigate to the ios directory and install the dependencies:
cd ios && pod install --repo-update
2. Set the Bundle Identifier
Open the ios/Runner.xcworkspace file in Xcode.
Set the Bundle Identifier for each target:
Runner
: your app’s package name. (eg. com.example.pushwoosh)NotificationService
: your app’s package name with.NotificationServiceExtension
(eg. com.example.pushwoosh.NotificationServiceExtension)StopwatchWidgetExtension
: your app’s package name with.StopwatchWidget
(eg. com.example.pushwoosh.StopwatchWidget)
3. Set the API Token
In your ios/Runner/Info.plist
set the Pushwoosh_API_TOKEN
key to the Pushwoosh API Token
Android
1. Setup google-services.json
Copy your google-services.json
file to the android/app directory
2. Set the package name
Open android/app/build.gradle and set the applicationId to your app’s package name. (eg. com.example.pushwoosh
)
3. Set the API Token
Open your android/app/src/main/AndroidManifest.xml file and add the following metadata inside the <application>
tag:
<meta-data android:name="com.pushwoosh.apitoken" android:value="__YOUR_API_TOKEN__" />
Replace __YOUR_API_TOKEN__
with your Pushwoosh API Token.
Run the project
- Build and run the project.
- The app will have two tabs: “Actions” and “Settings”. Navigate to the Settings tab.
- Tap the Register for Pushes button.
- Grant permission for push notifications. The device will be registered with Pushwoosh.
Send a push notification
Go back to the Pushwoosh Control Panel and send a push notification to your registered device.