I think you might need to do deep linking within the android implementation. I know this guys branch.io have deep linking solutions for this. It might be worth checking out
Nov 28, 2019
2
Level 5
How do i open specific page in my android when click the push notification which has been sent by laravel
How do I open specific page in my android app when click the push notification. I have created a php script to push the FCM push notification but its just opening app front page..... I want the push notification to redirect to a differet page which has api => /api/get-notifications
public function send_push_notification($device_id,$title,$content) { //API URL of FCM $url = 'https://fcm.googleapis.com/fcm/send';
/*api_key available in:
Firebase Console -> Project Settings -> CLOUD MESSAGING -> Server key*/
$api_key = "api key goes here"
// prepare the message
$message = array(
'title' => $title,
'body' => $content,
'vibrate' => 1,
'sound' => 1,
);
$registrationIds = array($device_id);
$fields = array(
'registration_ids' => $registrationIds,
'data' => $message,
'notification' => array(
'title' => $title,
'body' => $content,
'vibrate' => 1,
'sound' => 1
)
);
//header includes Content type and api key
$headers = array(
'Authorization: key='.$api_key,
'Content-Type:application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL,$url);
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);
curl_close($ch);
return $result;
}
Please or to participate in this conversation.