This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by thatisusama on 20/3/2015. | |
*/ | |
public class MyFirebaseMessagingService extends FirebaseMessagingService { | |
@Override | |
public void onMessageReceived(RemoteMessage remoteMessage) { | |
String var1 = remoteMessage.getData().get("key1"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |