Apologies if this topic has been posted before. I am losing sleep over trying to figure this out.
I am having some trouble grasping the concept around push notifications in the Flutterflow ecosystem.
I have an existing database of users in Supabase. We are creating an app. Said app needs to have basic push notification functionalities (not to users specifically, but to all app members - this is for a conference app, so just basic announcements, etc), but we are not (and do not want) to use Firebase for Auth. Supabase doesn’t support push notifications out of the box.
I have looked at onesignal and I am wondering if we need to do something in the Flutterflow project to enable us to use onesignal for push notifications. How do we get the users already in our database to receive push notifications?
Can OneSignal be setup without doing anything in Flutterflow?
What is the best setup for push notifications using Flutterflow/Supabase?
Any ideas or if someone can point me in the right direction would be great. Any videos or articles with code examples would be appreciated. Willing to offer some payment in return for help/consulting.
UPDATE:
Iv'e tried to implement OneSignal by way of writing a custom action to subscribe users to notifications. However, I am running into the issue below.
Any help on this would be greatly appreciated!
I am receiving this error:
The getter 'shared' isn't defined for the type 'OneSignal'. Try importing the library that defines 'shared', correcting the name to the name of an existing getter, or defining a getter or field named 'shared'.
pubspec dependencies is onesignal_flutter: ^5.0.1
// Automatic FlutterFlow imports
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/actions/index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
// Set your action name, define your arguments and return parameter,
// and then add the boilerplate code using the button on the right!
import 'package:onesignal_flutter/onesignal_flutter.dart';
Future<void> initOneSignal() async {
// Set the log level for debugging (optional)
OneSignal.shared.setLogLevel(OSLogLevel.verbose);
// Initialize OneSignal with your App ID
await OneSignal.shared.init(
"85a6457c-e09e-434c-97d9-fb3569408ff0", // Replace with your OneSignal App ID
iOSSettings: {
OSiOSSettings.autoPrompt:
false, // Set to true if you want the default iOS prompt
OSiOSSettings.inAppLaunchUrl: true,
},
);
// Request permission from the user for notifications
final status = await OneSignal.shared.getPermissionSubscriptionState();
if (status.permissionStatus.status != OSNotificationPermission.authorized) {
// Handle the case where notification permission is not authorized.
// You can show a dialog or perform any other desired action here.
// For example, you can request permission again or inform the user about the need for notifications.
}
}