android - Notification without using firebase console -


i'm newbie in android, have created program send notification using firebase without using firebase console.i have used php backend happeing i'm getting notification when send through firebase console, when send through wamp server can't.though i'm getting success:1

you can send notification using following php code server

function sendnotification($fields = array()) { $api_access_key = 'your key'; $headers = array (     'authorization: key=' . $api_access_key,     'content-type: application/json' ); $ch = curl_init(); curl_setopt( $ch,curlopt_url, 'https://fcm.googleapis.com/fcm/send' ); curl_setopt( $ch,curlopt_post, true ); curl_setopt( $ch,curlopt_httpheader, $headers ); curl_setopt( $ch,curlopt_returntransfer, true ); curl_setopt( $ch,curlopt_ssl_verifypeer, false ); curl_setopt( $ch,curlopt_postfields, json_encode( $fields ) ); $result = curl_exec($ch ); curl_close( $ch ); return $result; } $title = 'whatever'; $message = 'lorem ipsum'; $fields = array ( 'registration_ids'  => ['deviceid'], 'data'          => '', 'priority' => 'high', 'notification' => array(     'body' => $message,     'title' => $title,     'sound' => 'default',     'icon' => 'icon'     )     );    sendnotification($fields); 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -