Skip to content

Instantly share code, notes, and snippets.

View thatisusama's full-sized avatar

Muhammad Usama thatisusama

View GitHub Profile
@thatisusama
thatisusama / gist:30bb0470b3fbe306acdd694699c3d723
Created April 15, 2017 08:05
Retrieving Firebase Data Message in Android Notification
/**
* Created by thatisusama on 20/3/2015.
*/
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
String var1 = remoteMessage.getData().get("key1");
@thatisusama
thatisusama / sendmessage.php
Created April 14, 2017 11:49
FCM php sample code
// function creation
public function sendMessage($data,$target)
{
//FCM api URL
$url = 'https://fcm.googleapis.com/fcm/send';
//api_key available in Firebase Console -> Project Settings -> CLOUD MESSAGING -> Server key
$server_key = 'Your-Server-Key';
$fields = array();
$fields['data'] = $data;