Sign into your google account android

How to Add a New Google Account on Your Android

For people who have an Android phone or tablet, it is an option to add a Google account into the device. If you add Google account, you can take advantage of the convenience it can offer. Not only will you be able to answer text messages and calls immediately, you can send replies to important emails without having to open your computer too.

Why is it necessary to learn how to add a Google account? If you add an account to Google, you can enjoy a plethora of benefits. Here are some of the benefits to enjoy if you add new account with Google:

• Availability for receiving emails on the Android smart phone once you set up Google account on Android.

• Easy synchronization of data such as contacts and calendar to the Android smart phone where you set up new Google account.

If you didn’t add account to Google beforehand, know that it is not yet too late to create new Google account. You just need to learn how to set up a new Google account. You might even benefit from other Google-related tutorials such as how to get a Google play account. You can take full advantage of the Google services such as Google Drive, Google Calendar, and Gmail better if you sign in to Google account Android.

It should not be that difficult to add new Google account to your smart phone. The steps are pretty easy to follow. Here is a simple tutorial on how to set up a Google account on your Android smart phone.

Step 1 From the home screen, go to the “Settings” menu.

Step 2 Scroll and look for “Account”. Tap it.

Step 3 Look for the “Add Account” option. You will be adding Google account to Android right here.

Step 4 Since you want to add account to Google on your phone, you will have to choose “Google” on my phone.

Step 5 If you have already created a Google new account, then you simply need to select the option “Existing” among the options found on the screen.

a: Since you have selected “Existing” as your option, then that means you just need to set up Google account on Android. With this step, you will have to sign into your Google phone account with the right password.

b: Once you have signed in, you will be greeted with the Google Terms of Service. Tap on the “OK” button to signify that you agree to that.

Step 6 If you have not yet made a new Google account, then you will have to open Google account for Android. For this, instead of selecting “Existing”, you will need to choose the option “New”. You will need to follow through the steps to make your own Gmail account.

The next thing that you have to do is to learn how to setup a Google account. Do not just stop after you add account to Google. So, how do I setup a Google account?

Читайте также:  Как восстановить прежние настройки андроид

Via the Email App

Step 1 You can set up the Android Gmail using the Email app. You just need to download and install Gmail into your Android phone.

Step 2 Go to your App drawer and look for the Email app. Start this application.

Step 3 Select “Others”.

Step 4 You will need to enter your Gmail address and password. This way, you can successfully add Google account Android.

Step 5 Just click on “Next” and “Next” when you see the said buttons appear on the screen.

Step 6 You have now successfully added the account! Tap “Done” for that.

Via the Gmail App

Step 1 It is possible to use the Gmail app for this. Just select the Gmail icon in your app drawer.

Step 2 As soon as it launches, you will be asked what Google account you want to add. Choose “Existing”.

Step 3 Sign in using our Google account and password. Tap on the “next” icon.

Step 4 Tap “OK”.

With your Android smart phone, you are not limited to adding one account. If you know how to make another Google account, then you will most likely be tempted to make another one. You can also add this new account beside your main one. If you want to add another account, then here are the steps to take:

Step 1 Go to “Settings”. This is usually the gear button that is located at the upper right corner of your screen after you have swiped down the home screen’s top panel.

Step 2 Once on the “Settings” screen, you can then scroll down and search for “Accounts”. Tap on it.

Step 3 Look for the option of “Add Account”. This is what you will need to tap to Android add Google account.

Step 4 The “Add Account” screen should display. There will be green dots located at the right side to indicate all those successful Android add account. You will need to scroll down to find and tap on “Google”.

Step 5 And you are done! Basically, it is just the same with how you added the first Google account you have.

As a bonus tip for those who are adding phone to Google account, here is a tutorial on how to make a Google Play account. Usually, you need Google Play to be able to download apps or even when downloading the Gmail app. Google Play usually activates when you already add Google account to Android.

Step 1 From the Home screen, go to the Apps drawer and look for the “Play Store” icon. You will need to tap on this.

Step 2 Since this is the first time you are setting up the Play Store, you will be directed to the “Add a Google Account” screen. You have to tap the “Existing” option for this.

Step 3 Sign in using your Google credentials.

Step 4 You will most likely be asked to set up your payment information. You can choose to skip on this step if you do not plan to make purchases off of Google Play.

Step 5 You can now start using the Play Store!

Источник

Start Integrating Google Sign-In into Your Android App

Before you can start integrating Google Sign-In in your own app, you must configure a Google API Console project and set up your Android Studio project. The steps on this page do just that. The next steps then describe how to integrate Google Sign-In into your app.

Prerequisites

Google Sign-In for Android has the following requirements:

  • A compatible Android device that runs Android 4.4 or newer and includes the Google Play Store or an emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or newer and has Google Play services version 15.0.0 or newer.
  • The latest version of the Android SDK, including the SDK Tools component. The SDK is available from the Android SDK Manager in Android Studio.
  • A project configured to compile against Android 4.4 (KitKat) or newer.
Читайте также:  Удалить данные whatsapp андроид

This guide is written for users of Android Studio, which is the recommended development environment.

Add Google Play services

In your project’s top-level build.gradle file, ensure that Google’s Maven repository is included:

Then, in your app-level build.gradle file, declare Google Play services as a dependency:

Configure a Google API Console project

To configure a Google API Console project, click the button below, and specify your app’s package name when prompted. You will also need to provide the SHA-1 hash of your signing certificate. See Authenticating Your Client for information.

Get your backend server’s OAuth 2.0 client ID

If your app authenticates with a backend server or accesses Google APIs from your backend server, you must get the OAuth 2.0 client ID that was created for your server. To find the OAuth 2.0 client ID:

Pass this client ID to the requestIdToken or requestServerAuthCode method when you create the GoogleSignInOptions object.

Next steps

Now that you have configured a Google API Console project and set up your Android Studio project, you can integrate Google Sign-In into your app.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Источник

Start Integrating Google Sign-In into Your Android App

Before you can start integrating Google Sign-In in your own app, you must configure a Google API Console project and set up your Android Studio project. The steps on this page do just that. The next steps then describe how to integrate Google Sign-In into your app.

Prerequisites

Google Sign-In for Android has the following requirements:

  • A compatible Android device that runs Android 4.4 or newer and includes the Google Play Store or an emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or newer and has Google Play services version 15.0.0 or newer.
  • The latest version of the Android SDK, including the SDK Tools component. The SDK is available from the Android SDK Manager in Android Studio.
  • A project configured to compile against Android 4.4 (KitKat) or newer.

This guide is written for users of Android Studio, which is the recommended development environment.

Add Google Play services

In your project’s top-level build.gradle file, ensure that Google’s Maven repository is included:

Then, in your app-level build.gradle file, declare Google Play services as a dependency:

Configure a Google API Console project

To configure a Google API Console project, click the button below, and specify your app’s package name when prompted. You will also need to provide the SHA-1 hash of your signing certificate. See Authenticating Your Client for information.

Get your backend server’s OAuth 2.0 client ID

If your app authenticates with a backend server or accesses Google APIs from your backend server, you must get the OAuth 2.0 client ID that was created for your server. To find the OAuth 2.0 client ID:

Pass this client ID to the requestIdToken or requestServerAuthCode method when you create the GoogleSignInOptions object.

Next steps

Now that you have configured a Google API Console project and set up your Android Studio project, you can integrate Google Sign-In into your app.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Читайте также:  Android ice cream sandwich поддерживаемые телефоны

Источник

Авторизация через Google в Android и проверка токена на сервере

Недавно мне захотелось создать личный проект на андроиде, и основной вопрос был такой: как однозначно идентифицировать пользователя заставляя его делать как можно меньше телодвижений? Конечно же это аккаунт Google. Я пытался пробовать множество примеров в сети — однако API несколько раз обновилось за время своего существования, многие методы не работали, мои вопросы в Google+ по этому поводу либо были вообще никак не восприняты окружением, либо были вроде «Никогда такое не делал».
В этой статье я постараюсь как можно более просто для новичков (вроде меня) описать мой метод авторизации в Google на андроид, получения токена и проверке этого самого токена на сервере.

Небольшая подготовка

Для начала — у вас должны быть установлены Google Play Services в SDK. После их установки можно будет импортировать все необходимые библиотеки. Статья пишется с расчетом на Android Studio — он сам подсказывает, что необходимо импортировать.
У вас должно быть создано активити с кнопкой.
Чтобы было привычнее пользователю можете создать стандартную кнопку Google+ Sing-In
Выглядеть она будет вот так:

Просто добавьте в ваш Layout:

Добавляем действие на кнопку

Пишем в нашем активити:

Собственно присвоим кнопке действие — вызов интенда выбора аккаунта. Если вы работаете в Android Studio он сам вам подскажет, какие библиотеки нужно импортировать, так что это подробно тут я расписывать не буду.
startActivityForResult(intent, 123); — задает код с которым произойдет возврат. 123 это код возврата, он может быть каким угодно. Это необходимо, когда вы делаете несколько интендов, и вам надо обработать их по разному.

Необходимые области доступа

Обьявите эти переменные в классе. Это необходимые нам области доступа. Первый написано в google: «Позволяет определить аутентифицированного пользователя. Для этого при вызове API необходимо указать me вместо идентификатора пользователя Google+. » Второе разрешение нам необходимо для получения личных данных пользователя (Имя, Фамилия, адрес G+ страницы, аватар), и последнее для получения E-mail. Я посчитал это важным, ведь это вполне неизменный идентификатор для записи в бд.

Регистрация нашего приложения.

Изначально забыл этот пункт — исправляюсь.
Нам необходимо зайти на code.google.com/apis/console создать там проект, зайти в Credentials и создать новый Client ID для OAuth выбрав пункт Installed Application -> Android. Там нам необходимо ввести название нашего пакета и SHA1 сумму нашего ключа.
С этим у меня на самом деле было много проблем решил достаточно костыльным способом.
Нашел debug.keystore в %USERPROFILE%\.android\debug.keystore поместил в папку с проектом и прописал в build.grandle:

После чего нам нужно выполнить команду:
keytool -exportcert -alias androiddebugkey -keystore

/.android/debug.keystore -v -list
Сам keytool можно найти в SDK. Из вывода копируем SHA1 в нужное поле.
Как я понимаю метод временный, и для нормальной работы надо создать нормальный ключ. Но для тестирования этого достаточно.

Код получения токена

Где 123 — ваш код, который вы указали ранее, где AcrivityName — название вашего актитивити. Грубо говоря — мы скармливаем функции получения токена необходимые разрешения и имя аккаунта. И заметьте — это все происходит в фоновом режиме, после чего полученный токен передается в написанную мною функцию reg. Она уже отправляет токен и все необходимые данные на сервер.
Так как разрабатываю недавно, с исключениями пока что беда, если есть предложение — напишите в личку или в комментарии.

Проверяем токен на сервере. (PHP)

Хочу обратить внимание, полученный нами токен имеет тип Online. И действует он лишь 10 минут. Для получения offline токена (чтобы дольше работать с ним с сервера) обратитесь к этой инструкции developers.google.com/accounts/docs/CrossClientAuth

Собственно скармливаем токен в googleapis и забираем полученный JSON ответ.

Источник

Оцените статью