feat: Firebase Cloud Messaging push notifications
Backend: - New user_fcm_tokens table (migration 010) for storing device tokens - FCMService sends push via Firebase HTTP legacy API (server key from .env) - POST /api/fcm/register endpoint for Android to register its FCM token - AdminController::sendNotification() triggers FCM push after DB insert - FCM config added to config.php Android: - Firebase Cloud Messaging service (ServerManagerFirebaseService) receives push notifications and shows them via NotificationHelper - FCM token registered with backend on new token and on login - google-services.json template (must be replaced with real Firebase config) - firebase-setup.sh script with configuration instructions - FCM dependency + google-services plugin added to Gradle - Bump to v1.8.0 (versionCode 12)
This commit is contained in:
46
install/firebase-setup.sh
Normal file
46
install/firebase-setup.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# Firebase Cloud Messaging setup script
|
||||
# =======================================
|
||||
#
|
||||
# This script creates placeholder files for FCM integration.
|
||||
# You must replace them with real values from your Firebase project.
|
||||
#
|
||||
# Steps to set up Firebase:
|
||||
#
|
||||
# 1. Go to https://console.firebase.google.com/ and create a project
|
||||
# (or use an existing one)
|
||||
#
|
||||
# 2. Add an Android app to your Firebase project with package name:
|
||||
# com.devlab.app
|
||||
#
|
||||
# 3. Download google-services.json and place it at:
|
||||
# android/app/google-services.json
|
||||
#
|
||||
# 4. Go to Project Settings > Cloud Messaging and copy the
|
||||
# Server key (legacy) or Cloud Messaging API key
|
||||
#
|
||||
# 5. Set the server key in .env:
|
||||
# FCM_SERVER_KEY=your_server_key_here
|
||||
#
|
||||
# 6. OR place your Firebase Admin service account key at:
|
||||
# config/firebase-service-account.json
|
||||
# (for the OAuth-based API - more secure)
|
||||
#
|
||||
# The app will work without FCM configured; push notifications
|
||||
# simply won't be sent until Firebase is set up.
|
||||
#
|
||||
# ---
|
||||
|
||||
echo "Firebase setup script"
|
||||
echo "====================="
|
||||
echo ""
|
||||
echo "To enable push notifications:"
|
||||
echo ""
|
||||
echo "1. Create a Firebase project: https://console.firebase.google.com"
|
||||
echo "2. Add Android app with package: com.devlab.app"
|
||||
echo "3. Download google-services.json → android/app/google-services.json"
|
||||
echo "4. Get Server Key from Cloud Messaging settings"
|
||||
echo "5. Add to .env: FCM_SERVER_KEY=your_key_here"
|
||||
echo ""
|
||||
echo "Without these steps, push notifications are disabled."
|
||||
echo "The app will continue to work using polling as fallback."
|
||||
Reference in New Issue
Block a user