0

I'm looking to insert data to BigQuery from a mobile app (developped in Unity) every time an user opens an app and logs into Facebook.

I was wondering if I can directly use the streaming API of BQ from a mobile app? From what I have read, to use the streaming API, I need to create a BQ client, and a to use a BQ client, I need to authenticate. In that case, I think I might have to create an API that will receive the data from the devices that would open the mobile app to stream the data to BQ.

Or, is there a way to authenticate from the mobile app? Am I missing something? Should I proceed differently in my situation?

Thanks in advance!

azekirel555
  • 577
  • 2
  • 8
  • 25

1 Answers1

1

Take a look at linking BigQuery with Firebase. You can have your app report events to Firebase, which are automatically exported to BigQuery on a daily basis. From BigQuery, you can run queries to see how many users have opened the app and triggered a particular event.

Elliott Brossard
  • 32,095
  • 2
  • 67
  • 99
  • Is there still a way to insert data directly to BQ from a mobile app ? I have tried using Firebase Analytics but I don't especially like the table schema it's using and I don't think there's a way to not export the events and user properties that are automatically collected (which I'm not interested in). – azekirel555 Apr 27 '17 at 10:42
  • If you aren't happy with the Firebase schema, you can [create a view](https://cloud.google.com/bigquery/docs/views) over the table that gives you something nicer to work with (this would be my preferred approach). Another option would be to [use a service account](https://cloud.google.com/bigquery/authentication) in the app itself to stream to BigQuery, but I suspect that Firebase would be easier to set up. – Elliott Brossard Apr 27 '17 at 10:55
  • Thanks for your reply @Elliott Brossard. About the service account option, as I'm doing this for a mobile app (unity). I have to follow this guide: https://developers.google.com/identity/protocols/OAuth2ServiceAccount with the HTTP/REST section, is that right ? I have another question about this guide on signing with SHA256withRSA, I'll open a new question. About the view approach, is there a way in BigQuery to automatically create a view automatically (every 24 hours for example) as exports from Firebase create a new table everyday ? – azekirel555 Apr 27 '17 at 13:26
  • I'd be happy to answer the question about creating a view if you post a separate question--the comment section is a bit confined :) You don't need a separate view for each day. I'm less knowledgeable about service accounts but maybe someone else can answer. – Elliott Brossard Apr 27 '17 at 13:30
  • I understand, thanks! I have created the question here: http://stackoverflow.com/questions/43659780/creating-views-periodically-in-bigquery. I have another question but I have to wait 90 minutes to post another one, sadly :( – azekirel555 Apr 27 '17 at 13:53