With a real project, the Firebase 1 console's Messaging page has Send test message: paste the token from the registration event. A server uses the FCM HTTP v1 API (from the Firebase documentation; not run here):
curl -X POST https://fcm.googleapis.com/v1/projects/PROJECT_ID/messages:send \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"message": {"token": "DEVICE_TOKEN",
"notification": {"title": "Back in stock", "body": "Salt and Saffron is here"},
"data": {"bookId": "3"}}}'$ACCESS_TOKEN is a short-lived OAuth 2.0 token for the firebase.messaging scope, minted from a service account key. BookNest reads the data fields on a tap:
PushNotifications.addListener('pushNotificationActionPerformed', ({ notification }) => {
show('pushAction', notification); // the user tapped a push notification (Section 4.15.6)
const { bookId } = notification.data;
if (bookId) f7.views.current.router.navigate(`/books/${bookId}/`);
});A tapped FCM notification starts the activity with the data fields as extras plus google.message_id, and the plugin's handleOnNewIntent() reports any such intent as a tap, so adb can fake one without Firebase:
adb -s emulator-5558 shell am start -n com.example.booknest/.MainActivity \
--es google.message_id 0:demo-1 --es bookId 2Output
LAB pushAction {"id":"0:demo-1","data":{"bookId":"2"}}
routeChange /books/5/ -> /books/2/ [book]