# Unfortunately app stopped when FCM push notification run

**URL:** <https://forum.ionicframework.com/t/unfortunately-app-stopped-when-fcm-push-notification-run/91221>\
**Category:** ionic-v1\
**Created:** [May 22, 2017, 6:49am UTC](https://forum.ionicframework.com/t/unfortunately-app-stopped-when-fcm-push-notification-run/91221 "2017-05-22T06:49:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwon](https://avatars.discourse-cdn.com/v4/letter/i/ecd19e/32.png) [@iwon](https://forum.ionicframework.com/u/iwon)\
**Post date:** [May 22, 2017, 6:49am UTC](https://forum.ionicframework.com/t/unfortunately-app-stopped-when-fcm-push-notification-run/91221/1 "2017-05-22T06:49:54Z")

</div>

=\> FCM push notification not working in above android version 5,  
=\> API create in php framework codeigniter,  
=\> When i try to send notification using FCM Unfortunately app stopped .  
=\> Please give me example to send FCM push notification using API.  
below code ,

function send\_android\_notification($registration\_ids, $message) {  
$msg = array(‘message’ =\> $message,‘title’ =\> $message);  
// $msg = array(‘message’ =\> $message,‘title’ =\> ‘heello’);  
$fields = array(  
‘registration\_ids’ =\> array($registration\_ids),  
‘data’=\> $msg  
);

```
        $headers = array(
        'Authorization: key = AAAA4AEYLS8:APA91bFgkH-_IzUqh3GVRNsiEVdWzix84f4MXkAMpuTevMfz44EmAUSH2W1CvtKHiyW3gBFZCnJk2Cnd0mrqZ3N_bDF7yWn8tzzNkQaWF9rzKm2MJxIDMh9EjSaLxymgDz3fezeDOBCG', 
        'Content-Type: application/json'
        );
        // Open connection
        $ch = curl_init();

        // Set the url, number of POST vars, POST data
        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 );

        // Disabling SSL Certificate support temporarly
        curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
        curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );

        // Execute post
        $result = curl_exec($ch);
        if($result === false){
        die('Curl failed:'.curl_errno($ch));
        }
        // Close connection
        curl_close( $ch );
        return $result;
        }

```

// call function  
$result = $this-\>send\_android\_notification($android\_device\_token,$message);

Ionic Info

Cordova CLI: 7.0.0  
Ionic Framework Version: 3.1.1  
Ionic CLI Version: 2.2.3  
Ionic App Lib Version: 2.2.1  
Ionic App Scripts Version: 1.3.6  
ios-deploy version: Not installed  
ios-sim version: Not installed  
OS: Windows 8.1  
Node Version: v7.9.0  
Xcode version: Not installed
