我正在尝试通过发布/订阅库将数据发送到GoogleCloud中的主题
I'm try to send data throught pub/sub library to my topic in GoogleCloud
projects/navigator-cloud/topics/navigator-location这是Google地图的一个项目,其中包含建筑物的叠加层图像,我应该使用它.我想发布包含以下信息的JSON: {"Username":"oscarhmg","Location":"labproto","Timestamp":"2016-12-04T15:29:05Z"} .
Here is a project of a google map with a overlay image of a building, which I should use. I want to publish a JSON with some info like this: {"Username": "oscarhmg", "Location": "labproto", "Timestamp": "2016-12-04T15:29:05Z" }.
当主题收到此信息时,建筑地图中会显示一个标记(此地图在我的应用程序中以网络视图显示).该功能已经实现,我仍然不了解的是如何通过我的android应用程序传递消息以发布有关此主题的消息.任何帮助将不胜感激
When the topic receive this info, in the building map appears a marker(This map shows in my application in a web view). This functionality is already implemented, what I still do not understand at all is how to pass the message to publish on this topic through my android application. Any help would appreciate it
推荐答案查看此Android Things教程,该教程使设备无需通过Web服务器即可直接将消息发布到Google Cloud Pub/Sub.进行身份验证的方法是在Android应用中构建.json凭据.
Check out this Android Things tutorial that has the device directly publishing messages to Google Cloud Pub/Sub without going through a web server. The way to do the authentication is by building the .json credential into the Android app.
github/androidthings/weatherstation
更多推荐
Google Cloud.发布/订阅Android应用
发布评论