I have a xamarin android app and I want to add notifications. I followed the instructions from this link:
https://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote-notifications-with-fcm/
Everything worked great until I got to the Implement Client App Code section. At first, when I clicked the button to get the InstanceId token, I didn't get anything. So I added the bit of code that shows the google_app_id. Mine does not match the mobilesdk_app_id value in the json file. But then I did get an InstanceId in the output. I used that id in the firebase console and the message fails, "Unregistered registration token". I followed the directions exactly, twice. And searched for the error but did not find any answers. I guess my token is wrong? How do I fix that?
I just went through the same tutorial and received the same error in the firebase console. My problem turned out to be my android emulator configuration.
In the Android Virtual Device Manager I had to set my device's Target to Google APIs
I also had to install Google Play services from the Android SDK Manager
Lastly, I uninstalled my app on the emulator and reinstalled it to refresh the token.
After these steps i was able to send push notifications from the firebase console.
This video helped me out.
Related
I am initializing Firebase dynamically with FirebaseApp.initializeApp(Builder) with all the project attributes set(including gcmSenderId), so I have no google services JSON in the project root as I'm choosing the firebase project at login. Everything works fine(auth sdk, firestore sdk, storage sdk etc.) apart from FCM. I'm getting the token successfully through onNewToken() method and then trying to send a test push to the token. I'm not getting the test push.
I've tried to set "firebase_messaging_auto_init_enabled" and "firebase_analytics_collection_enabled" to false and then after initializeApp to call FirebaseMessaging.getInstance().setAutoInitEnabled(true); but still doesn't work.
I can see in the logs that "Missing google_app_id. Firebase Analytics disabled. See ..." error is thrown so this may be the reason it's not working, but can't figure out why as google services json is missing intentionally and everything is fine after dynamically setting up Firebase.
I can´t figure it out anymore, I've tested all kind of things, im testing to receive the token from firebase messaging. Im almost secure that first time i've received it but after that, no more and always the same error. this is being tested with android 11 wear os 3. so it is an emulator to a weareable.
The most common ways to solve this by comments is adding options to initialization or adding Firebase Installations api to the credentials of the api key, or checking the networkconfiguration xml with some options but nothing. nothing works.
I've testing with the last firebase bom(30.3.1), and tried with lower versions too.
at the begginings of the logs says "I/FirebaseInitProvider: FirebaseApp initialization successful" but then all errors after a while.
We are trying to get API Key and Sender ID using Google Developer Console https://developers.google.com/mobile/add
We enter the App Name and Android Package Name using correct format. We get the error message "There was an unknown error while processing the request. Try again."
A couple of weeks ago we could use this process and had no issues.
When I click the link and go to the Developer Console - the project was created. And we can use the console to get the API Key and Sender ID. The problem is we need to have the SHA-1 to create the API key, and that's more difficult process.
Anyone else having this issue? Is this a temporary issue with Google GCM, or do we need to go through the Developer Console t create the API key?
I got the same issue while logging to google using multiple accounts.
log in to single google account and try.
This might be a stupid question but I am facing an issue when trying to generate my google-services.json file for my app. I am following this guide from the google developers team to setup my project for analytics but when I click on the get configuration file button nothing happens, I just get a loading spinner that never ends.
I tried on different browsers, it's still the same. I checked the chrome console and got :
Refused to display 'https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…3Dtrue%26cntlbl%3DContinue%2BAdding%2BAnalytics%26cntapi%3Danalytics&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').
Any suggestion?
You are trying this link while configuration https://developers.google.com/analytics/devguides/collection/android/v4/start
So please do the following steps
Click on the GET A CONFIGURATION FILE
Now Choose your App Name.
Click Configuration Services
After that the 3rd Window will be open
Now Choose your Analytics account of your Apps.
Hurry you have done.
Please use all the process and done as it is you can do it.
Let me know if still you have any problem.
Well well, got a workaround. You console log helped: I clicked on the URL in the log ("https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…3Dtrue%26cntlbl%3DContinue%2BAdding%2BAnalytics%26cntapi%3Danalytics&hl=en") and it led me to the right page and I have been able to generate a google-services.json for my app.
A guy from Google analytics team suggests the solution here.
Try going through this website to get your configuration file - its the one for Cloud Messaging but it has a button that says "GET CONFIGURATION FILE":
https://developers.google.com/cloud-messaging/android/client
Also I did experience the same problem last week sometime when configurating cloud messaging myself but it seemed to have resolved itself in the afternoon so it could just be a one day error thing.
Steps for getting configuration if your first time login to google developer account.
open google developer console.
login to developer console.
create project with valid name.
then goto the API section & enable GCM API.
Then get the configuration file.
I followed the same steps that are mentioned in the "Android Cloud to Device Messaging (C2DM) - Tutorial", downloading the source code for the project and customizing it for my purpose (changing the package name and role e-mail sender).
Unfortunately I get an error message stating:
"Unable to start service Intent
{act=com.google.android.c2dm.intent.REGISTER ... }: not found" in logcat.
Knowing that I have added a Google account to the emulator which is different than the one I used when signing up on the service in the first place.
Can anyone provide help or direction in how can I get the registeration key correctly setup and solve this problem?
I think I figure the solution for my above question which is, you have to create new AVD using android AVD manager that its target Google APIs either level 8 or 15 or whatever, not using android API.
and also you have to have google account that added to your emulator which is the role e-mail that you used in development process of your application.
I hope that solve all problems faced other developers regarding this issue.