This is my first question, so please be careful. As part of my university project, I need to develop an Android application that allows you to upload files and share files with other users. I am new to Android programming (I watched some Android Beginner videos and developed some basic applications for practice) and was the first to use cloud computing as a developer. I am using Amazon web services.
I have a code that allows me to log in using my google account and will show my name, email id and profile photo after logging in. I want to integrate it with Amazon Cognito so that I can get a unique identifier that I can use to further work on AWS. How can I get this unique key for each user who signs in the application?
I watched some tutorials but couldn't figure out how to integrate Cognito code into my code.
Here is my code.
package com.unicloud.project; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import android.accounts.AccountManager; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.IntentSender.SendIntentException; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.auth.GoogleAuthException; import com.google.android.gms.auth.GoogleAuthUtil; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; import com.google.android.gms.plus.Account; import com.google.android.gms.plus.Plus; import com.google.android.gms.plus.model.people.Person; import com.amazonaws.auth.CognitoCachingCredentialsProvider; import com.amazonaws.regions.Regions; public class loginWithGooglePlus extends Activity implements OnClickListener, ConnectionCallbacks, OnConnectionFailedListener { private static final int RC_SIGN_IN = 0;
This link has Android code, but I'm not sure where to add this code to the program. Should I create a new class? Please help me with this.
source share