1. Generate Sha Key Android
  2. Sha Key Biography
  3. How To Generate Sha Key In Android Studio
This API is deprecated. Clients must migrate to the Drive REST API or another suitable solution to avoid disruptions to your application.

This post show how to get the sha1 fingerprint for debug and how to get the sha1 fingerprint for release for all the users of MAC or Windows or LINUX, the process for generating the SHA1 fingerprint certificate is shown in a simple step by step manner for both the debug and release key. Apr 16, 2017  How to Get Generate SHA1 MD5 Key Certificate from Android Studio in Windows, Linux, Mac. Start a fresh project in Android Studio or Open your existing project from which you want. Click on Gradle ( Present on the right side of your Studio screen ). Double Click on signingReport.

Authorizing requests on Android differs from other authorization workflowsbecause of the integration withGoogle Play services.Unlike other workflows, authorization on Android uses a SHA1 fingerprint andpackage name to identify your app instead of a client ID and client secret.

Jul 08, 2018  As you do for generating signing apk. We can do that in Android Studio by clicking (Build - Generate Signed APK) then create new and fill the information required such as (keystore path. When you are ready to publish, you can sign your app using Android Studio upload it to Google Play. The key with which you sign your app becomes your app’s upload key. Google uses the upload certificate to verify your identity, and signs your APK(s) with your app signing key for distribution as shown in figure 1.

For an example of authorization with Android, see theAndroid Quickstart. For more information onAndroid development, see theAndroid documentation.

Note: This guide assumes you have already created and configured an Androidproject. For an example of creating a project, see theAndroid Quickstart.

Generate the signing certificate fingerprint and register your application

If you haven't already registered your application with the Google API Console, then set up a project and application in the API Console. The system guides you through the process of choosing or creating a project and registering a new application, and it automatically activates the API for you.

If you've already registered your application with the API Console, then follow this procedure instead:

In a terminal, run the Keytoolutility to get the SHA1 fingerprint for your digitally signed.apkAndroid file's public certificate.Note: For the debug.keystore, thepassword is android. For Eclipse, the debug keystore is typicallylocated at

Generate Sha Key Android


The Keytool prints the fingerprint to the shell. For example:

Copy the SHA1 fingerprint, which is highlighted in the example above.

Important: When you prepare to release your app to your users, follow these steps again and create a new OAuth 2.0 client ID for your production app. For production apps, use your own private key to sign the production app's .apk file. For more information, see Signing your applications.

Next, create credentials appropriate to your project in theGoogle API Console:

  1. Open the Credentials page in the API Console.
  2. Follow these steps if your application needs to submit authorized requests:

    1. Click Create credentials > OAuth client ID.
    2. Select Android.
    3. In the Package name field, enter your Android app'spackage name.
    4. Paste the SHA1 fingerprint into the form where requested.
    5. Click Create.

    Otherwise, follow the steps below, which are for applications that only need to make unauthorized API calls:

    1. Click Create credentials > API key.
    2. Select Android key.
    3. Paste the SHA1 fingerprint into the form where requested.
    4. Type your Android app'spackage nameinto the form where requested.
    5. Click Create.

Connecting and Authorizing the Google Drive Android API

Authorization for the Google Drive Android API is handled by theGoogleSignInClient. Thisis typically created in an activity'sonCreate() method.

Note: The Google Drive Android API currently only supports drive.file anddrive.appfolderauthorization scopes. If your applicationrequires additional permissions or features not yet available in the DriveAndroid API, you must use theGoogle APIs Java Client.

To get the account for the current user, you need to callGoogleSignInClient.getGoogleSignInAccountFromIntent()The getGoogleSignInAccountFromIntent() method returns aTask object. In the success handlerfor the Task object, you can access theGoogleSignInAccountassociated with the current user.

Once you have the GoogleSignInAccount object, you can then create an instanceof theDriveClientandDriveResourceClientclasses, which allow you to access the contents of the user's Drive.

The following code snippet demonstrates one technique for accessinga GoogleSignInAccount from the success listener of a Task object.It also demonstrates how to instantiate a DriveClient andDriveResourceClient object after sign-in has succeeded.

Connecting and Authorizing with the Google APIs Java Client

In some cases, applications may need to use theGoogle Drive web serviceto access additional features or access broader scopes than what is availablein the Google Drive Android API. In these cases, your application must usethe Google APIs Client Library for Java.

This code sample demonstrates instantiating the Drive service to send requests.Note that at this point, you have not yet authenticated the user's credentialsor requested authorization to access their Drive files.

Authorization happens in response to receiving an error when sending a request. Yourapp must be prepared to catch the UserRecoverableAuthIOException. This meansthe user needs to authorize the app.

The following code sample demonstrates how to handle this exception.

Sha Key Biography

Upon completion, your app should either go back to sending the request (user granted access),allow the user to select an alternate account, or display an appropriate message.

Next steps

How To Generate Sha Key In Android Studio

Now that your application is authorized, you can create and openfiles and folders, orquery for files.

Coments are closed
Scroll to top