Google Cloud.发布/订阅Android应用 [英] Google Cloud. Pub/Sub Android App

查看:51
本文介绍了Google Cloud.发布/订阅Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过发布/订阅库将数据发送到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.

https://github.com/androidthings/weatherstation

这篇关于Google Cloud.发布/订阅Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆