0

I am using davibennun/laravel-push-notification in laravel framework for push notification, it worked well in iphone device but in android it gives

"Unable to enable crypto on TCP connection gcm-http.googleapis.com"

I also tried with

$deviceToken = "dxu8XvChIXg:APA91bEUASmBE_bpDzHlgvf9RZhLYE4W7ni5xeRZ-ze-QKE‌​-1uUFbTcWkGJ05GkbTWb‌​cU8tceA_rnUwDgBr8w46‌​cylkkvz9ORoCmdqSt8Ao‌​VviGRdQbcM1GtbDZqWdc‌​SpyJpZPSX2SRP";
$push = PushNotification::app('Androidpush');
$push->adapter->setAdapterParameters(['sslverifypeer' => false]);
$push->to($deviceToken)->send('Hello World, i`m a push message');

What I am doing wrong...??

Please suggest me if you already done.

Thanks in advance

1 Answer 1

1

I don't see any error with the code you provided as compared with this related issue. This could be an issue with how your http adapter is configured. Try to use the curl adapter, and/or make sure that the sslcapath is set to a valid location. Check this thread which one of the community also encounter the issue on Android devices.

Change the vendor/sly/notification-pusher/src/Sly/NotificationPusher/Adapter/Gcm.php

Gcm.php -> public function getOpenClient(....){  
$client->setApiKey($this->getParameter('apiKey'));

    $new_client = new \Zend\Http\Client(null, array(
                      'adapter' => 'Zend\Http\Client\Adapter\Socket',
                      'sslverifypeer' => false
                  )); 
    $client->setHttpClient($new_client);
    return $client;
}
Sign up to request clarification or add additional context in comments.

1 Comment

public function getOpenedClient() { if (!isset($this->openedClient)) { $this->openedClient = new ServiceClient(); $this->openedClient->setApiKey($this->getParameter('apiKey')); $newClient = new \Zend\Http\Client( null, [ 'adapter' => 'Zend\Http\Client\Adapter\Socket', 'sslverifypeer' => false ] ); $this->openedClient->setHttpClient($newClient); } return $this->openedClient; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.