Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

android - Syncing app data to Google Account

How exactly does one use the Google account sign in feature in Android Apps?

For example, is it possible to store application data such as tables, shared preferences etc., to a google account from an Android app, and what advantages does this offer over a normal account creation feature inside an app?

The reason I ask is that in the app I plan to develop, it will contain an sqlite database to store rss urls to a user, along with shared preferences and content providers. How would the login process differ between the custom login for the app vs the Google Account login process?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I recommend using the Google Drive Android API if you want to store data to the cloud.

To use those APIs, you will need to authenticate your users using this guide.

For example, is it possible to store application data such as tables, shared preferences etc., to a google account from an Android app

The Drive API lets you save any type of file to a hidden folder on the user's Google Drive account. You could save a database, a JSON file, or whatever else you want.

what advantages does this offer over a normal account creation feature inside an app?

Here are a few advantages to allowing your user to use a Google account to sign in to your app:

  1. Security- Google spends a lot of time and energy ensuring that Google accounts are secure. If you use Google accounts in your app, you don't need to spend time and energy making sure your custom solution is secure.

  2. Convenience- Assuming your users are running standard Android, they are guaranteed to have a Google account already. They don't need to create a new account and they don't need to remember another password.

  3. Access to Google APIs- If you are trying to sync to the cloud, you can use existing APIs from Google to sync data. You don't need to implement this yourself using your own servers.

If you are only doing local storage (you don't need to save to the cloud or sync between devices), then you don't need the Drive APIs, but you still get the other benefits of using a Google account.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...