An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
March 26, 2022 05:56 am GMT
Original Link: https://dev.to/krixnaas/send-notification-on-expo-reactnative-app-from-laravel-php-3a5f
Send Notification on Expo ReactNative App from Laravel | PHP
public function notifyApp($app_id){ $payload = array( 'to' => $app_id, 'sound' => 'default', 'body' => "New Task Assigned" ); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://exp.host/--/api/v2/push/send", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => json_encode($payload), CURLOPT_HTTPHEADER => array( "Accept: application/json", "Accept-Encoding: gzip, deflate", "Content-Type: application/json", "cache-control: no-cache", "host: exp.host" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } }
Original Link: https://dev.to/krixnaas/send-notification-on-expo-reactnative-app-from-laravel-php-3a5f
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To