Firebase Cloud Messaging Push Notifications using the Android, PHP, MYSQL PART 2/2
Why Stack Overflow recommends it
Stack Overflow users link it when answering or asking about sending FCM push notifications from a PHP server, often as a replacement for the deprecated GCM.
Recommended by 1 people across 1 different months, 2016 to 2017.
What it is
A short 2016 tutorial by Filip Vujovic, part 2 of 2, showing how to write a PHP script that sends a request to Firebase Cloud Messaging and broadcasts a push notification to Android devices. It builds on part 1, which covers the Android client and MySQL token storage, and links a GitHub project.
What people said
Recommends Faruk · 2016-07 · Stack Overflow · on “Chat App using GCM, PHP & MySQL”
GCM is now deprecated, try to migrate using Firebase Cloud Messaging, Follow these tutorial series : Send FCM using php part 1 [LINK] Send FCM using php part 2 [this video] And this is an example to create simple chat app : Chat App with Firebase Realtime Database part 1 [LINK] Chat App with Firebase Realtime Database part 2 [LINK]
Cites Gaurav Sarma · 2016-08 · Stack Overflow · on “Display Notification on Android Device using Firebase or any other way”
Firstly, you need to go to the firebase console and create an app. (For this you will need to login into your google account) and follow the steps provided here. [LINK] Once that is done you will need to add these services to your Manifest.xml file <service android:name=".firebase.FirebaseMessagingService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter> </service> <service android:name=".firebase.FirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service> FirebaseInstanceIdService.class public class FirebaseInstanceIDService extends FirebaseInstanceIdService { private sta
Cites AlexMel · 2017-04 · Stack Overflow · on “FCM Push Notif script”
I followed a tutorial to do Firebase Cloud Messaging Push Notifications using the Android Studio. Here's the tuto : [this video] So i got a problem with my push_notification.php : <?php function send_notification ($tokens, $message) { $url = ' [LINK] '; $fields = array( 'registration_ids' => $tokens, 'data' => $message ); $headers = array( 'Authorization:key = AAAALXOnumg:APA91bGI7Qfrl0XVX52KOfjfKfzFcezbD6mwwIti7oswMAvGn3Z9Q1toxJ9IiXiXRFc_vB21NRnwNaI-vYPxcEMO5JH53RrfAtnjxyA5fzaiwONSnLY987ephLapy0ijTyW9VLwwoPBJSq', 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_se