Sending data from Android app to device

Looking for a way to press a button on an Android app that sends a message to a device to do something, preferably using Google Cloud Platform (“GCP”).

I followed this the GCP integration doc (https://docs.particle.io/tutorials/integrations/google-cloud-platform/) which explains how to set up the integration for the device to send data to GCP, but the integration page on my console shows this:

image

suggesting that I can send data from GCP to the Particle cloud, for which the event name will start with “/hook-response/server/”, so I can just program my device firmware to subscribe to that. But I can’t find anything about how to get GCP to send data to the Particle cloud in the first place. The data will originate from the Android app but it’s gotta go through GCP, right?

@gusgonnet

Hi Spencer, not necessarily.
The way suggested by Particle is that your app calls directly the cloud functions on the device.
Please refer to the cloud API here:
https://docs.particle.io/reference/device-cloud/api/

How do you declare a cloud function in the firmware?
Like this:
https://docs.particle.io/reference/device-os/firmware/photon/#cloud-functions

However, it could go via the GCP if you wanted, perhaps for a particular reason on your architecture.
I suggest you start by calling the functions directly via the cloud API, and then decide.

Gustavo.

1 Like