如何授权我的Android应用程序在后台任务中向Google BigQuery上传数据? [英] How to authorize my Android App to upload data to Google BigQuery in a background task?

查看:124
本文介绍了如何授权我的Android应用程序在后台任务中向Google BigQuery上传数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在后台任务中将Android数据上传到Google BigQuery。我想,我可以使用Java库执行插入作业 。但授权页面说:


在授权流程中,应用程序会将用户重定向到Google托管的网页,以请求访问BigQuery API。


但这不是我想要的。我想要在后台上传数据。我不想授权Android应用用户,我想授权应用。



可以使用Google BigQuery存储我的大数据Android应用程序?我怎么才能批准我的应用程序对谷歌?



我希望,你明白我的问题,并可以给我一个提示。


<您可以使用Google BigQuery存储我的Android应用程序收集的大数据。

b
$ b

是的。 BigQuery一次可以加载大量数据(最高可达1 Tb),并且可以运行每个项目多达10,000个加载作业,但实质上,将数据加载到BigQuery是一个批处理过程。因此:

方法1:
创建一个基于web的应用程序,通过RESTful API从您的Android应用程序收集数据。然后,每隔一小时(每小时?)将新收集的数据移到Google云端存储中。最后,启动BigQuery提取作业,将最近收集的数据从Google云端存储中提取到BigQuery中。


构建第一部分的一种方法是使用App Engine数据存储从您的Android应用程序收集数据。您可以使用新的Datastore Admin备份到BigQuery功能 href =http://developer.android.com/training/id-auth/authenticate.html =nofollow>请参阅这里的教程)授权访问BigQuery API,然后使用直接POST请求(使用多部分MIME请求)将数据添加到BigQuery表。此流程要求Android应用用户在使用应用时授权访问BigQuery API。


I want to upload data to Google BigQuery from my Android App in a background task. I think, I could do an insert job with the Java library. But the authorization page says:

During the authorization flow, the application will redirect the user to a Google-hosted webpage to request access to the BigQuery API.

But this isn't what I want. I want to upload the data in the background. And I don't want to authorize the Android app user, I want to authorize the app.

It is possible to use Google BigQuery to store my big data collected by my Android app? And how do I have to authorize my app against Google?

I hope, you understand my problem and could give me a hint.

解决方案

Re: "It is possible to use Google BigQuery to store my big data collected by my Android app?"

Yes. BigQuery can load quite a lot of data at a time (up to 1 Tb), and it is possible to run up to 10,000 load jobs per project, but essentially, loading data into BigQuery is a batch process. Therefore:

Method 1: Create a web-based application to collect data from your Android app via a RESTful API. Then, at intervals (daily? hourly?), move newly collected data into Google Cloud Storage. Finally, kick off a BigQuery ingestion job to ingest the recently collected data into BigQuery from Google Cloud Storage.

One way to build the first part is to use the App Engine Datastore to collect data from your Android application. It's possible to use the new Datastore Admin backup to BigQuery feature to load your collected data into BigQuery for analysis.

Method 2: You can use Android's AccountManager class (see tutorial here) to authorize access to the BigQuery API, and then use a direct POST request (using a multi-part mime request) to add data to a BigQuery table. This flow requires the Android app user to authorize access to the BigQuery API when using the app.

这篇关于如何授权我的Android应用程序在后台任务中向Google BigQuery上传数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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