Android App Development: Account Credentials and Database Backup - android

I am new to Android app development and have a few questions.
Suppose I want to create an app that has user login. I want to authenticate the users over the internet. Where should I collect and store all the user accounts and their credential information? Will this storage be free or paid?
Can I integrate Google Sign-in in my app for free? Where should I store the google sign-in account information of all the users?
Is it possible to integrate Google sign-in and backup the app database (.db files etc.) and other user settings to the user's Google Drive (for later recovery when app is reinstalled)? Is this free or paid?

Answering Questions 1 and 2:
There are a few options:
1) Firebase:
If you only want to work on the mobile app, not on the backend software, the easiest way is Firebase.
Firebase has built-in support for Google authentication and you can follow the tutorials provided by Google here, and the samples here. (I`m using the link because the code is too big to paste here on the answer.) The authentication service is free.
2) Self implementation:
You can use Google sign in API on this example and implement the server side if you have a backend team or want to do it yourself.
About Question 3 (Google drive), users can use their own Google account to store applications backups, and you can select what application files will be stored. In this case, they will consume their free Google Drive quota, and thus the service will be Free.
Google provides an API for that, and you can have have a look on this example here. (Notice that Google had deprecated Google Drive Android API on December/2018. But the example on the link shows what you have to do on the newer way, using Drive REST API).
There are other approaches and solutions but I tried to give you the simplest and cheapest ones.

Related

Google Drive V3 API implementation Xamarin Android

I've been trying for a while now to create an application where the users can sign in with their Google Account and the application will automatically upload some files into the users google drive.
So far I've managed to implement the Sign In mechanism but for the Google Drive integration I'm kind of confused if I should use a Service Account or not.
I've found this solution here Google Drive API implementation Xamarin Android but this way too old, and I can't find any updated solutions.
If anyone knows any solution or any suggestion I will appreciate it.
Think of serive accounts as a dummy user, this user can then be preauthorized to access some data.
You could share a folder on google drive with a service account and then the service account would have access to that folder on google drive.
Service accounts are intended for use by developers to access data they control.
If you are going to access the users account then you will need to use Oauth2, and request consent of the user to access their google drive account.
Unforuantatly it appears that Google Drive Android API used in the question you have linked is deprcated.
I can also tell you that the Google .net client library does not support Xamarin authorization.

Android app sign in only with google (without email option)

I'm creating an app that signs in users with google sign in. I was wondering, do all android users that downloaded my app (from google play store) have a google account? I want the user to do as little non app-related actions as possible at the onboarding stage and google sign in just solves this corner for me but if not everyone has a google account then I'd have to make an alternative email & password option..
Thanks in advance
If you are not highly comfortable with server side and devOps, and all you want is just signup-login, I think the best option is to use Firebase Authentication and I highly recommend it.
From docs
Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.
And it is free for email and google login you mentioned. And only costs if you used phone verification when exceeds the monthly limit. See pricing here

Using google drive to store data for respective user?

I'm trying to develop android app something like "Notes". The idea is to ask user to sign in to his google account and use his drive space to store his notes. Simply user should have his data with him & should pay for storage if necessary. Also in future this should work for Windows, iOS.
Till now, I have discovered Drive API and I'm confused. Its is showing 'me' the billing options.
Any idea?
the billing options you see are for your console project. you wont need to enable billing unless you will use up the daily quotas. the free quotas are very large, in the millions of calls per day. those quotas are not related to the space your files will use in each user's drive. they just refer to your right to call the apis with your console keys.
I'm not sure where you are seeing billing options, but the Drive API stores items in the user's Drive using the user's quota.

Register/Login user using their Google Account?

I want my users to login with their Google accounts.
SwiftKey and Catch Notes do it by opening a WebView in their apps. I don't want to do that. I want to use AccountManager.
Tasks Free from Team Tasks uses it and loads your Google tasks easily. The official Google Reader app also uses it and loads your Google Reader feeds.
But I don't want to get any data of the user from Google except their name, email, etc. I only want to register the user and log them back in easily.
How do I register them with OAuth tokens etc?
All the examples I have found either use WebView or only load data from Google (not register).
When I first asked this question, it was really really hard to do. You had to use the Google Java API definitely not built for Android.
But there is now Google Play Services and this task is very easy to do.
Anyone can follow the below links:
https://developers.google.com/+/mobile/android/sign-in
https://developer.android.com/google/play-services/index.html
Google I/O 2011 covered Android + App Engine, which uses Google accounts for authentication. The Android client uses AccountManager. Here's the screenshot.
You may want to look at AccountsActivity in the source code.

Can I use AccountManager to let users sign in with their Google account?

I'm creating an app that will need users to create an account. (Like Facebook or Twitter would require you to.)
BUT, since it's an Android app, should/can I let them sign in with their Google Account using AccountManager or some other service? It'd be very helpful if they could just sign in to their Google account and their settings and other options would be saved to that account.
Main questions summed up:
Is it possible to let a user just use their Google account in my app?
If so, do I use AccountManager to have them sign in and save account information/settings?
What are other options?
Yes, you can get users to log into their Google Services using their Google credentials, for example, I have an app on Google Tasks and I use the Android AccountManager to let users authenticate themselves using their Google account on the android device (No need for users to enter their password!)
There are some really good examples to get you started:
This is an in-depth look into how you can authenticate based on the users Android credentials, has an example of how things work and how the UI should be: http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2
This is an example of getting AccountManager to work with a Google service like Google Tasks: https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android
The last example is using the same concept for accessing the Google Picasa service: http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager
The other options you have is to have users manually enter their username/password. For that you have to use a third party authentication API (like signpost for OAuth) for them to log in.
In my tasks/todo application I provide users both options to sign in, using their android credentials or using third party authentication for users that want to log in using some other account (an account which is not enabled on that device)
Let me know if you have more questions
Although it is a new development, Google Plus Sign-in introduced as part of Google Play Services can also be used. More info can be found at Android developers blog. See example implementation from Banjo app
There seems to be a big limitation - The user need to have Google+ app installed on the device to use this.
Also this is a pretty good blog if someone is interested in implementing the solution.
#Soham gave you some very useful links but he didn't correct one major error: AccountManager is the entity that manages the accounts on your Android device - it has nothing to do with your google account! you can use google account and create a NEW account on your device using the AccountManager.
The rest you can learn from the links Soham gave you.

Categories

Resources