is it possible to add one Firebase URL in my two application.? - android

Hi i'm beginner for android studio and Firebase,I have done one small Firebase project. In this project i get Url from firebase console site when i add my project package name. My question is it possible to use one firebase project url to another (different package name )new project. If possible means pleas guide me..

Add two Android apps to your Firebase project, download the google-services.json and add it to both Android Studio project. I do this all the time and it works without problems for me.
If you are having problems, describe what you've tried and where it fails.

Related

Configure multiple firebase project for a single flutter app

I'm developing a flutter app, which needs at least 2 projects for 2 different environments (development and production). My flutter app is already bound to a project, and when I tried creating another firebase project and adding the flutter app to the new project, after filling the package name and SHA, it says that OAuth2 client already exists for this package name and SHA-1 in another project, which probably refers to my first project. I'm a bit confused as to how should I start configuring the second project, I've tried going to the Firebase documentation, but the guide for android application starts with google-services.json which is only available to download after an application has been added to a firebase project. Any help would be greatly appreciated :D

How to change Firebase id by creating another project

I want to rename my Firebase id.
I found out that the only way to do that is to create new project
How can I rename the Firebase Project ID?
I've created a new project and pasted the same android applicationId.
I've added the correct json file into my project.
Then Firebase suggests me to run my app in order to test the connection.
I've reinstalled my app, but I have no connection.
Does it mean that I should delete the prerious app in order to make this app work?
Maybe change the default project will sove this problem.
Run this command:
firebase use --add <YOUR_NEW_PROJECT_NAME>
Or if you want to test a project in emulators which is not exist on your firebase, just delete the default project by running:
firebase use --clear

Firebase / Cloud Messaging

I've got some issues regarding the integration of Firebase in my Android Unity app.
I created a project on firebase with my Unity Bundle Identifier.
In authentification I enabled email and anonymous (I just exactly follow all the steps provided by Firebase in their tuto).
On Unity side I got the last firebase plugin.
First of all I started to have some manifest issues:
CommandInvokationFailure: Unable to merge android manifests. Error:
[Temp\StagingArea\AndroidManifest-main.xml,
C:\Users\Public\Documents\Unity
Projects\WheelRotation\Temp\StagingArea\android-libraries\com.google.firebase.firebase-measurement-connector-impl-16.0.0\AndroidManifest.xml:10]
Trying to merge incompatible
/manifest/application/service[#name=com.google.firebase.components.ComponentDiscoveryService]
element
To solve this issues I just updated my manifest on Unity side to be able to compile the app and launch it on my android phone.
I succeeded to do that but when looking at the Firebase/Authentification/ Users, my Android app didn't appear.
Furthermore, when Using firebase cloud messaging interface, I can't succeed to send message (I can select the app, then click on Send but when I check my message no message was sent (the Sent column stays on 0) and obviously I don't receive the message on my android phone.
Thx in advance for your precious help.
Regards.
I'm using Unity Version: 5.4.1p2 (really need this version for specific plugins) all all other plugin are uptodate (JDK and Android sdk)
I recently discovered a bug in the newer Firebase version with Unity which relates to the ComponentDiscovery Service. Since I don't know how to mark as possible duplicate, I repost my solution here, which may help you:
The solution behind this seems to be the package name variable, which
unity won't replace by the actual package name in the latest builds.
https://forum.unity.com/threads/android-gradle-cannot-read-packagename-from-gradleout-src-main-androidmanifest-xml.524587/
proposes a temporary fix, by renaming the package="${applicationId}"
variable inside the "\Assets\Plugins\Android\AndroidManifest.xml" on
line 4 with the actual package name e.g :
package="com.MyCompany.MyGame"

Is there another place to get a google-services.json?

I tried clicking the GET A CONFIGURATION FILE link from the docs, but the resulting page just loads and loads. This happens in Firefox and Chrome and on my phone. Is there some other way to get a config file?
EDIT: I am getting these errors in Chrome Dev Console:
Refused to display 'https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…ed%253Dtrue%26cntlbl%3DContinue%2BAdding%2BSign-In%26cntapi%3Dsignin&hl=en' in a frame because it set 'X-Frame-Options' to 'DENY'.
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://console.developers.google.com') does not match the recipient window's origin ('null').(anonymous function) # script_foot.js:348n.event.dispatch # jquery.min.js:3r.handle # jquery.min.js:3
This might be a temporary issue due to network connectivity or something like that.
One solution would be to try again at a later point in time. This might be happening because you're trying to download the google-services.json for the sample project (com.google.samples.quickstart.signin).
If you want result now, you could follow the steps to integrate the Google Sign In into your app.
Create a new empty android studio project/if you have an existing
project skip this step.
Use this link and follow the onscreen instructions to generate the google-services.json for your app.
The app name here refers to your project name in Google Developers
Console. If you've already setup your Google developers console
project for your android app, you can select that via the drop-down
menu. If you have not created one, just enter a name and that
project will be created for you in your developers console.
Select the google services you need for your project viz Google Sign
In, Google Cloud Messaging, AdMob etc. In our case, we just selected
Google Sign In.
You will be asked for SHA-1 hash. Follow these steps to get one.
Click on generate configuration files. Next screen you will be presented with an option to download google-services.json for your app. Download that and you're good to go.
Once you have the google-services.json, follow these steps to complete the Google Sign In.
References
Start Integrating Google Sign-In into Your Android App,
Integrating Google Sign-In into Your Android App.
You will get "google-services.json" as soon as you create a Firebase project.
But, in case you missed and forgot to download that, you can still get the JSON file from the existing project-
Just select the project from firebase console.
Head over to project settings
scroll down (Yeah!, there it is!)
Screenshot :
OK, I've found a workaround if anyone else is having this problem.
Based on the error message about being unable to display https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…ed%253Dtrue%26cntlbl%3DContinue%2BAdding%2BSign-In%26cntapi%3Dsignin&hl=en in a frame... I just followed that link directly.
EDIT: None of the other links were working for me. If you came searching for the console errors Refused to display..., this is the answer for you. This bug seems to have been fixed for the google-services.json, so if you're just looking for the link, the highest-rated answer is the one you want.
Referring to this page:
The Firebase console will help you download the google-services.json. In addition, the Quickstart guides for most APIs have instructions for generating this file. Once you have downloaded the google-services.json file, copy it into the app/ folder of your Android Studio project, or into the app/src/{build_type} folder if you are using multiple build types.
So go to Firebase Console, press add new project and follow instructions

Deploy to App Engine trouble - You must be logged in to perform this action

I am new to Android Studio and have just runned through the tutorial
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints
without much trouble.
However, when I try to deploy my backend to the app server it promts me: "You must be logged in to perofrm this action".
I have no idea of why it teels that. I can easely find me project on the list, and Im logged in to my google acount on various browsers including Chrome.
Have seached the internet, but found no one else with the problem before.
Best Regards Allan
It's possible that your auth has been done a little while ago and the system cannot properly see you authenticated anymore, which would explain such a behavior.
At the bottom of the list of projects, you should see a "add account" button. Click on this and just re-auth. Should clear the bad tokens :).
Steps For Intrgration of App Engine Endpoints Module.
.....................................................
1-:Create an Google Devloper Console Account.Create a new project after completing the project creation they give you a Project id and project no.
2-:Open Android Studio File-->New-->New Project.
3-:After Project creation is completed Right Click On your project select Module-->Google Cloud Module as shown in images folder chouse_module image.
4-:When you Select The Google Cloud Module Then choose "App Engine Java Endpoints Module".as shown in images folder endpoints image.
5-:As soon as the backend module is added to your project and Gradle sync finishes,a new run configuration with your backend's module is created.
6-:Rebuild your project via "Build → Rebuild Project"
7-:Now Check Your Backend started sucesfully naivigate to http://localhost:8080.if your Backend started sucessfully you saw the screen as as shown in images folder devappserver-endpoints image.
Connecting your Backend to your android project.
...........................................................
8-:After Backend Module is created and added strong libraries is automatically genrated for you.
9-:To start sending requests to the added Cloud Endpoints backend API.you Have to created one Async Class in your Project file.you Can Get the Async task class in required Packages folder with name AsynctaskClass.java
10-:To make the actual call, invoke this AsyncTask from one of your Android activities.In this way :: new EndpointsAsyncTask().execute(new Pair(this, "Message"));
11-:Ckeck that you granted an internet permission in menifest or not.
12-:Now check that you have accese to local host as shown in point 7.
13-:Its time to Check in Emulator Change your Run confrigation and run your project If everything goes well, you should see the following toast in your app as shown in images folder emulator-Toast image.
Deploying the backend live to App Engine
......................................................
14-:If your backend is working locally, you can deploy it to Google App Engine.
Stop the backend, if it is running locally, by selecting Run > Stop.
Than navigate to Build > Deploy Module to App Engine.
15-:update your src/main/webapp/WEB-INF/appengine-web.xml file's property and replace myApplicationId with the ID of the project that you just created.as shown in point 1.
16-: you can see the screen as shown in images folder deploy-image image.
17-:In the Deploy to you have to select the project you created on Google Devloper Console.as shown in point 1.
18-:Put the version name and click deploy Button.
19-:Once you have deployed your backend to App Engine, you can connect your Android app to it by modifying AsyncTask class defined in point 9 replace the perticular lines shown in ReplaceCode.java file in required Packages folder.
20-:Now you can communicate with your new App Engine backend!.
For More Info -:
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints.
https://cloud.google.com/tools/android-studio/app_engine/add_module?hl=en.
Ive never used android studio but Im sure its like eclipse sdk puglin.
There is an easy way to deploy ur apps on ur mobile device, but before u get to that point u need to eanable android mobile on debug mode (On settings,developer options).Once u have done that, Im pretty sure there is an option which lets u run ur app on android device making much smother than doing it virtual app.
Hope I helped ya...
Use the gradle commands.
Open the terminal within android studio and run
gradlew appengine:update
Or navigate to the gradle project window and look for the google appengine folder under your backend. And double click the appengineUpdate command.
Adding the backend with android studio should automatically add the appengine plugin for gradle in your backend build.gradle file like this. This plugin is allows you to run the appengine update command.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
I was facing similar issue using Android Studio Ver2.2 in Ubuntu 14.04
I was not able to do sign-in into Android Studio using the SignIn icon from top-left of the Android Studio IDE. When signin icon clicked, a pop-up says that Sign-in using external browser but nothing would pop-up.
Build->Deploy to app Engine->Deploy to tab was also showing the same message as above but no browser would pop up
Even gradlew api:appengineUpdate was not working. (no browser would pop up).
Problem got resolved by changing the File->Setting->Web Browsers (it was listing browsers Chrome, Firefox, Safari in that order). The Default Browser was set to "First listed". I unchecked the chrome and my problem got solved, I was able sign-in and deploy my project.
I spent lot of time finding solution for this, thought it might help others, so posting it.
I had the same issue.
I did not realize it at first but when you get this message, you simply click on the dropdown "Deploy To", and then it invites you to log into your google account.
It is not very intuitive if your project is already selected by default.

Categories

Resources