media drug app for android This is a topic that many people are looking for. savegooglewave.com is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, savegooglewave.com would like to introduce to you How To Make A Social Media App In Android Studio Android Tutorial 1. Following along are instructions in the video below:
“To the first video in this series. Where we ll be developing facebook and android android studio. I m going to start by giving a brief demo of the app you guys know what we re making then following that we will start creation of the login activity. I left i m sam sound in the description of the video.
If you want to skip ahead to the coding and with that being said let s get started. What we see here is a google sign in button. If we re signed into our google account on the emulator or android phone. All we have to do is click this button and it will immediately bring us to the newsfeed.
If you re not signed in you will have to enter your google credentials. So what we have here is our typical newsfeed. We see various postings from various people. If we re to pay attention to one of these posts.
We can see a visibility icon. This is a global icon. We can also make it so the post our friends only or private. We also see a time here as well as a like system in a comment system.
We ll be learning how to develop all of these a quick look at the comment system will show us that we have a comment itself as well as the ability to sub comment now on to the friends tab. Where we can see our list of friends as well as our incoming front of requests. If we were to click on one of our friends profiles we get brought to it and we can see all of their postings as well as the fact we can click on their picture and their cover picture to zoom in on it we can also see we are friends with a person and we can choose to unfriend that user. But we don t particularly want to do that right now onto our notifications tab.
We see all of our notifications. We can click on one of them and were brought immediately to the person s profile. Now this person has sent me a friend request. I can choose to accept it here or back in the friends tab in the profile page.
This is my profile. You can see all of my postings also pay special attention to the visibility indicator. Here. This is an only me post and this is a friends only post.
We also have the same features available. We can click on the profile picture as well as the cover picture and we can also change the cover picture and profile picture. If we were to change the cover picture. It would look something like this we simply just click on a picture from our storage and a cover picture change successful now for the most important part of the social networking app.
Which is to make the posts themselves so let s do that we click on this little icon. Here to upload an image and we ll just go ahead and add this one leave it a little comment sweet shot of a forest. There s something like that and we ll choose the friends..
Only post host is successful and if we go to our profile page. We see it right here give that alike okay so this is our app and we will be making this whole thing. All. The features that i just went over so let s get started with that if you haven t already go ahead and open android studio and once it s open select file new project.
We will select empty activity here. I m going to name this networking app. You may choose whatever you d like api level. 26.
Is okay and hit finish so once this loads up what we re gonna do is create our login activity. Which we look at prior in the demo to do that we go to the java folder. Our packages and select new activity at the gallery and we re going to select empty activity. This will be called login activity well i didn t hit finish.
Now. This is also going to generate us an xml file that we will use to style. The login activity. So let s go to that it s in our res layout and activity login folder.
Now we re gonna write some code in here. I m gonna go ahead and speed this up and explain after okay now that we ve created our layout file and sorry that this got out of your line of sight by the way. We ll scroll down there in a second so you can look at that code. But what we have here is we ve created a relative layout inside of our login activity with a width and a height of match parent right here further.
We ve created a frame layout to house all of our inner elements with match parent match parent. Same thing for this image view. However we see that we have an error and that s because of this image bg login is not in our drawable folder. So to get it there i left it down in the description of the video and once you ve downloaded it just move it to your desktop simply hit copy and paste.
It into the drawable folder. Make sure. This says drawable. Okay.
Okay and our air has gone away. So that s good and now we have a relative layout to house our textview and button. Our textview is just going to be the saying that we saw in the beginning of the video and with a bunch of styling this button is the most important thing on the login screen. I d say and it has an id of sign in button.
This is going to be the one that allows us to use google services to sign in in order to do that we have to use the firebase council. So let s go ahead and open up google chrome simply type in firebase council select. The first link and we re going to pick add project..
Now the project name just name it the same thing that you called your app. Whatever it is continue continue default account. Here and create project. We ll give this a sec to load.
Okay. Our project is ready to go we ll select continue and we re brought to our project overview screen. What we re interested in here is this little android guy and now to register our app. We need the package name so in my case.
It s calmed example dot networking app. And to see the package that you have all you need to do is either you can look here calm down example dot not working app or inside of your android manifest the package name will be right here okay so let s head back to firebase and the nickname optional. We do need the sha 1 key and to get that let s go back to android studio over here to the right select gradle go into app and then tasks and android and we re gonna double click this signing report. So once we ve done that we can see our sha 1.
Key. Is right here so give this a copy head back to our firebase and paste register app now at this screen we need to go ahead and download our google services json so hit download here and we ll open this up and say show in folder give this a copy and we ll paste it into our app level of our project make sure that there s no numbers behind this google services json. If you do have the numbers and hit ok. Now the next order of business is to go back to firebase and we re going to hit next so what we re interested in here is these implementations now.
We re gonna have to copy this go back to our project and inside of our project. A level folder. We re going to paste this right underneath. Here we won t sink just yet because we have a few more implementations now we can go ahead and also copy this the google play services and inside of our build gradle app level folder paste it right under here we can do the same with this next implementation.
We ll leave some space and give this a comment. So we know this is our firebase implementations and further we need to go to docs and the top right of our firebase. I m over to the authentication and we are going to select android and google sign in these two implementations here will allow us to use our button as a google sign in so go back to our app and paste them right underneath. Here now feel free to go ahead and sync our project.
We have synced up perfectly let s go to the android manifest file and we have to change a few things in here now currently our main activity is the one that we will see when we re launching the app. But we do not want that we are going to change this to default and we will copy this category and action or i m sorry we re going to copy the intent filter here go to our login activity. And just paste it in here switch this back to launcher and that way our login activity will be the first thing that we see when we first open the app. We also have to write some permissions and i m just gonna copy and paste them here you can go ahead and pause.
The screen make sure you have all of these permissions here and we ll be good to go. So let s now head over to our activity log in and change our buttons. So we can use it as a google sign in button the code we have to type here is simply change button to combo go android dms common sign in button and let s check if that works in our design looks like we have implemented the google sign in correctly. However our button is a little bit out of place so let s change that now that is because our width is wrap content when it should be match parent and we have to change our layout height to wrap content it looks like our buttons up top and that is because this relative layout here should in fact be a frame layout all right so it s looking perfect now.
Let s give the app. A run and see what we got all right gray it s working perfect now we re gonna head right into our login activity and we have a few things or a few variables to type out so. I m just gonna go ahead and speed up the typing..
And i will explain after it s done so here we go what we have here is our firebase authentication our user of course our sign in button. As well as our google sign in client. So let s just move right on to the next little bit of code and we re going to go into our on create activity and right here. We re going to initialize our sign in button.
You find the view by id and that s gonna be our id sign in button and for the next little chunk of code. We re gonna open up our council go over here and we re gonna hit go to doc s once we re here we re gonna click the little android guy over two authentication into android and scroll to google sign in now we already did this in the last video. So we don t need to do this. But our next chunk of code is going to come right from here so just copy this go back to our app and just paste this right here.
And we re gonna have to hit all enter to import that make sure you hit all alt enter on these two to import those okay. So our next bit of code. I m going to go ahead and speed up again okay so what we ve done here is actually initialize our google sign in client as well as a firebase authentication and our progress. Dialog is just going to pop up on the screen.
And tell us what is happening at the moment. Now right here we set an onclick listener for our sign in button. So basically you just say sign in button dasu onclicklistener. Put a new view to onclicklistener inside of it and within that we override the onclick method and our sign in method will be directing us to our main activity.
So let s go ahead and make that method right now. We ll say private void sign in and for this next. Bit of code. We can go ahead oops.
We ve done to make that lowercase and for the next bit of code. We can go ahead and open or reopen our google authentication and we re just going to copy this here. We can just see open this and paste that there we can actually just erase this. I forgot i didn t even need to type okay.
And we ll just back this up back that up delete this and we re gonna go ahead and hit all enter here so our signing method is straight and essentially. It is just i m creating in a tent in in 10 and then it s going to start our next activity. So the next thing that we have to do is override. The onstar method so to do that all we do is right click generate and go to override methods look for on start and click that so now let me actually make a little more space here now inside of our answer method we can get it from the google authentication sign in right here.
But we re actually gonna create our own code here. So what we re gonna say here is i m firebase user equals firebase authentication. Get current user so we re just getting the current user right here and then we re going to say if the firebase user is not equal to null then we re gonna say log and we ll say let me all enter their tag. And the message is going to say user is rt oops already logged in and we ll finish that up by saying start activity activity.
Active it t. Okay and here. We say new intent and the package context will be login activity dot..
This and will send us to the main activity class. Okay so all this is doing is if our user is not equal to null then we re just going to start the main activity okay and then we re gonna say finish alright it looks good now the next bit of code. We can get is directly from the google authentication page. So we ll just go here scroll to right here.
And we re looking for on activity. Result. So we can just go ahead and copy this come back and paste. Now we just have to hit all enter a few times.
So we ve done all the importing that we need we have one method here that we still need to create to authenticate and to do that we can just go ahead and create this private actually know that i believe this method is right on this page right here so this firebase off with google basically we re just authenticating our google account you see a credential right here when it s complete. We re checking or we re not checking. We re basically just getting the user the firebase user else we re gonna say failure so we will copy this come over here and paste. So we will need to hit all enter a few times.
Okay once we re done importing we need to change this here to say i m firebase off and change this one here to say i m firebase off. We also don t need this update. Ui or any of this here. Okay.
We re all set with this now and the next thing to do is to enable google login in our app. So what we re going to do here is go to back to the council. So we can go up here to the top right say go to council click on your app and in the develop section. We can go to authentication sign in method and go ahead and enable google login you can also enable email password.
If you want to just go here and hit enable and then hit save ok so now we re all set and if we go back to our app. We can give this a run and we re going to be looking for something as special into the logcat file. So we come to our main screen. And when we hit sign in we choose our account and now we are going to go and look at the logcat will say google activity and we see that the sign in with credentials is success so what happens here is if we were to go ahead.
And close the app and rerun it we will be logged in and this is the main activity. So we re all set with that now if you re having any problems. With this and you can t get it to run. And say success.
I would first go and check the project files and make sure you have the google services json correct and besides that just make sure that you went back and have all this code. How it is that will be it for this video guys don t forget to hit like and subscribe and in the next video. We re gonna work on finishing the login page as well as maybe starting creation on our user profile page. So we will see you in that video.
Thank you very much for ” ..
Thank you for watching all the articles on the topic How To Make A Social Media App In Android Studio Android Tutorial 1. All shares of savegooglewave.com are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.