当点击推送通知时,如何在我的Flutter应用程序中打开特定页面?我已经创建了一个PHP脚本来推送FCM推送通知,但只是打开应用程序的前台页面...... 我希望推送通知携带日期,并打开我的应用程序中的日历页面,并显示通知的详细信息。
<?php
if(isset($_GET['send_notification'])){
send_notification ();
}
function send_notification()
{
echo 'Hello';
define( 'API_ACCESS_KEY', 'Secret');
// $registrationIds = ;
#prep the bundle
$msg = array
(
'body' => 'App New Event Notification',
'title' => 'There is a new event added to the calendar',
);
$fields = array
(
'to' => $_REQUEST['token'],
'notification' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
#Send Reponse To FireBase Server
$ch = curl_init();
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 );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
echo $result;
curl_close( $ch );
}
?>