Flutter Push Notifications without Firebase

Feb 17, 2022

Set up Flutter Push Notifications in under 5 minutes (Firebase NOT required) using Native Notify. This video walks you through how to set up Flutter Push Notifications using Native Notify and how to send your first push notification to yourself.


Instructions in the video:

These instructions show how to add Native Notify push notifications to your Flutter app. After you follow these instructions, you will be able to send mass push notifications to all of your app users.

lib > main.dart file setup:

Step 1:

Paste this commands into your terminal and click return:

flutter pub add native_notify

Step 2:

In your "lib > main.dart" file, make sure these imports are included at the top of the screen:

import 'package:flutter/material.dart';

import 'package:native_notify/native_notify.dart';

Step 3:

In your "lib > main.dart" file, in the "void main()" function, paste this code BEFORE runApp():

void main() {

     WidgetsFlutterBinding.ensureInitialized();

     NativeNotify.initialize(your-app-id, 'your-app-token', null, null);

     runApp(myApp());

}

Do NOT delete the 'null' parameters, or Native Notify push notifications will not initialize properly.

android > app > build.gradle file setup:

Step 1:

In the "android" object, change "compileSdkVersion flutter.compileSdkVersion" to:

compileSdkVersion 31

Step 2:

In the "android > defaultConfig" object, change "minSdkVersion flutter.minSdkVersion" to:

minSdkVersion 21

ios > Podfile file setup:

Step 1:

The "platform :ios" at the top of the sceen needs to be '10.0' or higher. Here is an example:

platform :ios, '10.0'

Test Native Notify Push Notifications:

Step 1:

Open an Android emulator. Push notifications will NOT work in an iOS simulator.

Step 2:

flutter run

Step 3:

Send a push notification from your NativeNotify.com account.

Article Author Photo

TJ McCarty

Founder of Native Notify