Closed sahilmushtaq closed 5 years ago
could you point out the part that's not clear enough?
This is usage section on github.
use NotificationChannels\ExpoPushNotifications\ExpoChannel; use NotificationChannels\ExpoPushNotifications\ExpoMessage; use Illuminate\Notifications\Notification;
class AccountApproved extends Notification { public function via($notifiable) { return [ExpoChannel::class]; }
public function toExpoPush($notifiable)
{
return ExpoMessage::create()
->badge(1)
->enableSound()
->body("Your {$notifiable->service} account was approved!");
}
}
This is simple curl request
$payload = array( 'to' => 'ExponentPushToken[xxxxxxxxxxxxx]', 'sound' => 'default', 'body' => 'hello', );
$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"
),
));
Curl request is simple. Now i am confused in account approved class. Which class i will use for push notifications.
Thanks
Hi Alymosul,
I read the github documentation and complete it's configuration easily. But i am confused anoute it token setting. Usage section of this documentation is not clear for me. Could you please share a complete example link?
Thanks