From Nordic: How to connect nRF9160 DK to Google Cloud
This blog post covers how to connect to Google Cloud with an nRF9160 DK. The nRF9160 DK is using MQTT protocol to communicate with Google Cloud IoT Core, a service that connects to and manages IoT Devices. The project code is attached at the end of this post.
We used the Cloud IoT Core to get data from the nRF9160 DK into Pub/Sub, which is Google Cloud’s internal messaging service that allows us to send and receive messages from and to IoT devices. From here we used Cloud Functions as a functionality to react on, among other things, Pub/Sub events or HTTP triggers.
nRF9160 DK
In order to set up the development environment, follow the Getting Started Assistant in nRF Connect for Desktop. This is a guide on how to install the required tools for this project. In addition, it is recommended to read this tutorial about using the nRF Connect SDK to create an application. This also explains how to build and flash the application.
gcloud library
We have developed our own library for interfacing with Cloud IoT Core. It handles most necessary tasks; like provisioning of keys, connection, publishing and receiving. Description for the individual functions are found in the header file. Note that the library runs an infinite while loop polling on data from the cloud, this can interfere with other operations on the sockets.
Source: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/how-to-connect-nrf91-to-google-cloud