push notification - Firebase trouble with RMSPushNotificationsBundle -


i've trouble fcm notifications.

this config.yml

rms_push_notifications:   android:       fcm:           api_key: <my fcm key>            use_multi_curl: true      ios:           sandbox: true           pem: %kernel.root_dir%/var/ios/<mycert>.pem           passphrase: ~ 

and test code

/**  * @route("/test", name="test")  */ public function testaction(request $request) {     $notice = json_decode(curl::curlget('https://api.chucknorris.io/jokes/random'));     // curl::curlget($url) personal library , work      $out = [];      foreach ($this->findall("appbundle:device") $device) {         /* @var $device device */         switch (strtolower($device->getos())) {             case 'ios':                 $message = new iosmessage();                 $message->setmessage($notice->value);                 $message->setapssound('default');                 $message->setdeviceidentifier($device->gettoken());                  $out[] = $this->container->get('rms_push_notifications')->send($message);                 break;              case 'android':                 $message = new androidmessage();                 $message->setfcm(true);                 $message->setmessage($notice->value);                 $message->setdeviceidentifier($device->gettoken());                  $out[] = $this->container->get('rms_push_notifications')->send($message);                 break;         }     }      return new response($notice->value . ' - [' . implode(' | ', $out) . ']'); } 

if try send notification, server response is

every time chuck norris watches on olympic event, wins gold medal. - [android: | ios: 1] 

debugging code in androidfcmnotification.php see:

foreach ($this->responses $response) {         $message = json_decode($response->getcontent()); ->      // $message null !!!         if ($message === null || $message->success == 0 || $message->failure > 0) {             if ($message == null) {                 $this->logger->error($response->getcontent());             } else {                 foreach ($message->results $result) {                     if (isset($result->error)) {                         $this->logger->error($result->error);                     }                 }             }             return false;         }     } 

this google-services_json.js , think use correct api_key

{   "project_info": {     "project_number": "...",     "firebase_url": "https://project.firebaseio.com",     "project_id": "project",     "storage_bucket": "project.appspot.com"   },   "client": [     {       "client_info": {         "mobilesdk_app_id": "...",         "android_client_info": {           "package_name": "com.acme.project"         }       },       "oauth_client": [         {           "client_id": "...",           "client_type": 1,           "android_info": {             "package_name": "com.acme.project",             "certificate_hash": "..."           }         },         {           "client_id": "...",           "client_type": 3         }       ],       "api_key": [         {           "current_key": "..." <- use key in config.yml         }       ],       "services": {         "analytics_service": {           "status": 1         },         "appinvite_service": {           "status": 2,           "other_platform_oauth_client": [             {               "client_id": "...",               "client_type": 3             }           ]         },         "ads_service": {           "status": 2         }       }     }   ],   "configuration_version": "1" } 

i try code on macbookpro , on web server (based on debian 7), responses same.

how can fix code?


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -