I am currently working on two different apps but testing them on a single hardware device (as that is one of my usage scenarios) - I have seen a similar question at StackOverflow on how to send notifications to one of two apps in the same project at firebase
However, in my case I have two different apps (with different package names) and want to be able to differentiate when I use push_service.notify_single_device().
From the previous question I understand I can use restricted_package_name
but after lots of googling, I am yet to find any example code. How do I use this?
Would the following usage be correct?
pushresult = push_service.notify_single_device(registration_id=requester_fcm_key,
message_title="Message Title",
message_body="Please hold on while we connect you",
restricted_package_name='com.domain.packagename',
data_message=requester_data_message)
It would be great if someone could share some sample/example code that I could take a look at and understand.
While looking for answers, I loosened my search to include FCM usage in other languages and sure enough, I found a PHP example at stefanhoth's GitHub page
$fields = array(
'registration_ids' => $registrationIDs,
'restricted_package_name' => 'com.example.myandroidapp',
'collapse_key' => 'somekey_'.$messageType,
'data' => array( "KEY_GCM_MESSAGE_TYPE" => $messageType,
"payload" => $message ),
);