PushCommander Mission using Android Studio, Firebase and Backendless

Hey Backendless team, I have another question on the missions, hopefully, the last one but it’s around the Push Mission and setting up android studio and firebase.
I was hoping it was set up correctly but obviously not, I have gone through the documentation a couple of times and don’t think I missed anything - but I likely did… However, it seems like the android studio has updated recently and firebase-analytics have updated so you no longer need firebase-core implementation as well which threw me off. So here’s my rundown of everything.

Image 1 - When selecting a project in Android studio I selected Basic Activity, is this the correct template?

Image 2, 3 - After setting up a firebase account and getting the google-services.json file in the app folder I don’t see anything in android studio after syncing/rebuilding. Should this be the case?

Image 3 - Is the app build.gradle file that has all the implementations in it, I was getting errors when building with firebase-core:16.0.5 after reading the latest firebase documentation it seems that firebase-core is now standard in firebase-analytics:17.4.4 and this allowed a successful rebuild.

Image 4 - project build.gradle file - No issues here, seems straight forward from the documentation

Image 5 - App/Manifest seems also pretty straight forward, no questions here

Image 6 - Main Activity - It looks like I’m getting a lot of errors in this one and I’m not totally sure what to do about it as it looks the same from the video tutorial.

As far as I can tell, the two things that seem off are the fact that I’m not sure it’s actually using the google-services json file (Firebase can’t tell if it communicated with it recently) and the fact I’m getting a ton of errors on the Main Activity page.

Am I missing anything super obvious or how should I proceed?

app id = E1AC02F7-200D-7D96-FF38-C3117302B100
android key = 227DBF9A-1DC8-4C8F-829A-D1A77EFD4473

Thanks for your help!!

Hi @Kasey_Luft,

google-services.json should be added into Android Studio. I believe Google’s site talks about it when you download the file from there.

Have you added Backendless dependency to your project? Looks like you haven’t based on Image 6.

Regards,
Mark

Hi @mark-piller thanks for the help!

I’ve added google-services.json to the app folder which is what google recommends. Other people have said drag and drop into the UI but that didn’t work either. Is there something I need to do to import the file into the android studio project? Everything I have read said just put it in the folder or drag and drop.

Ahh I did find import com.backendless.Backendless; in the quick start guide. I’m not sure that was mentioned in the other documentation and in the video the imports were hidden so I couldn’t tell what else was needed. Is there a place where I can find all the imports?

I have also added the following:
import java.util.ArrayList;
import java.util.List;

But I’m also getting cannot resolve DeviceRegistrationResult, Toast, BackendlessFault

Sorry for the rudimentary questions!

Cheers,
Kasey

I found this which is sort of similar:

The last thing I have left is a cannot resolve symbol ‘context’ in the Toast.makeText(context, …

Update:

Added in public Context getContext() { return this; }

and changed context to getContext() as in the above link.

I think the last thing is to get the google-service.json working properly

google-services.json must be in your project. If it is not done, then the registration with the google servers to receive push notifications will not work. This is what it should look like in Android Studio:

@mark-piller changed the view to Project instead of Android and can confirm it’s there.

When I run the click the run ‘app’ button I get a message saying No matching client found for package name 'com.example.pushcommander'

For this error:

I googled and arrived at:

@mark-piller That looks like it did it! Thanks for working that out with me, again, I apologize for the rudimentary questions but getting pointed in the right direction was really helpful!

For completeness sake and anyone who stumbles upon this thread, these are my files that were slightly different from the documentation.

app build.gradle

app MakeActivity