Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Google's G Suite Apps share data?

It seems when you download a new Google Suite app for iOS - whether GMail, Inbox, Calendar or whatever - they offer you to log in with your account and already present to you the account you have logged in elsewhere.

The question is both for iOS and for Android.

I know that apps can use Safari or the new Safari WebView (Chrome Tabs in Android) and a permanent cookie to share data between apps. It's a bit clunky, and can be broken by the user deleting cookies. But other than that, it works.

Google seems to be using something else. AdvertisingID? How exactly do they achieve this feat of sharing data on both operating systems?

like image 207
Gregory Magarshak Avatar asked Jan 27 '17 20:01

Gregory Magarshak


2 Answers

AppGroup allows data sharing between two different apps or even app and widgets by creating one common shared path (like document directory). Data saved over there can be accessed by any app which is associated with that particular AppGroup. It is an offline data sharing between apps. Communicating and persisting data between apps with App Groups

like image 92
jia ma Avatar answered Sep 25 '22 11:09

jia ma


On Android:

They probably use Content Providers. As described in this link,

A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object. Together, providers and provider clients offer a consistent, standard interface to data that also handles inter-process communication and secure data access.

A content provider coordinates access to the data storage layer in your application for a number of different APIs and components, these include:

  • Sharing access to your application data with other applications;
  • Sending data to a widget;
  • Returning custom search suggestions for your application through the search framework;
  • Synchronizing application data with your server;
  • Loading data in your UI.

TL;DR In short, Content Provider is a layer that allows you to share your database with other apps/widgets. So Google Probably has a Content Provider in every app which shares the accounts that have been used on this app.


On iOS:

Now I'm just an Android Developer, but after a quick Google Search, I found this post which talks about UIPasteBoard:

Use the UIPasteboard class to let a user to share data from one place to another within your app, and from your app to other apps. For sharing data with any other app, use the systemwide general pasteboard; for sharing data with another app from your team—that has the same team ID as the app to share from—use named pasteboards.


I can't assure you that this is exactly the way Google does it. But If I were to implement such thing across my apps, I would use this.

like image 24
Rosário Pereira Fernandes Avatar answered Sep 25 '22 11:09

Rosário Pereira Fernandes