Firebase device token on Xamarin.Forms - firebase

I have a Xamarin.Forms project and I'm using the firebase messaging platform to provide push notifications to my app.
The last step that is stopping me from publishing the app is the lack of FirebaseInstanceId Nuget for xamarin.forms which seems to exist only for xamarin.android.
The reason behind why it is so important for my project is getting the cloud messaging token. From what I've seen throughout internet forums it wasn't covered clearly what to do in this situation.
The notifications in my app work in an unusual way. The user chooses one of around 30 options, and then depending on his choice he receives appropriate push notification.
So I've written a script that sends his choice to the firebase database and that is where his token is required so a javascript server connected to firebase could send him the push.
I hope I made it clear, and that that the solution wasn't covered previously on this forum. I'm still a beginner so a detailed solution or some suggestions would be really appreciated.

To implement notifications in Xamarin forms, you should do it on each platform(iOS and Android)and install Nuget packages to each platform.
Create a Xamarin.forms project name MyApp(Use this Name as an Example).
Right Click on the MyApp.Android(This is important, not MyApp) ---> Manage NuGet Packages
You should install these packages in Android Project:
(1). Xamarin.GooglePlayServices.Base
(2). Xamarin.Firebase.Messaging
Right Click on the MyApp.iOS(This is important, not MyApp) ---> Manage NuGet Packages
You should install these packages in iOS Project:
(1). Xamarin.Firebase.iOS.CloudMessaging
You can follow this article for more detail :firebase-cloud-messaging.

Related

We are getting this message in android store,Webrtc version is outdated for xamarin.Android app

https://support.google.com/faqs/answer/12577537
We are getting this message in android store. Fixing it is not mandatory for releasing but its a security risk.
Please help,how to update webrtc version.
Google stopped providing Android library directly for webrtc, but the source is open and the link you shared has instructions on how to build the Android library from source.
It is a long process, but if webrtc is essential for your app, you have to spend some time to set this up.
If you need a temporary fix, I found that someone does this in their github repo often, and you can use the Android library there directly
https://github.com/dbrgn/webrtc-android
Note that, the author of this library itself recommends to build the library from the source directly.
https://groups.google.com/g/discuss-webrtc/c/bO-d15ogjCs

Firebase Assistant not showing up for new projects in Android Studio

I've been trying to figure this out for several hours with no luck.
In older Flutter projects within Android Studio the Firebase Assistant appears in my Menu Tool-> Firebase; however, when I start new Flutter projects Firebase Assistant does not appear in the Tool's menu. Trying to open Firebase using search, produces a search result, but launching it fails (just an endless loading screen).
I've tried all of the listed items in these previously asked questions:
Firebase assistant not showing in Android Studio 3.4.1
Unable to find Tools > Firebase in Android studio 2.2.3
Firebase assistant not showing in Studio 2.2.3
I am using Android Studio 4.2.1
I've run updates on everything that I can think of to update.
The generally accepted answer in the previously asked questions referenced above is to ensure that the three Firebase plugins are enabled. I've verified that they are:
In older projects where Firebase Assistant appears in the Tools menu, if I disable the three plugins and restart, Firebase Assistant disappears from old projects. When I then re-enable them and restart, Firebase Assistant returns to the Tools menu in older projects. However, in a freshly created Flutter project, disabling and re-enabling the plugins does not cause Firebase Assistant to appear in the tools menu.
One person suggested making sure that you are logged into your Google account. I'm logged in, but that doesn't change anything.
I don't understand why it is available in old projects, but not in new projects.
I assume I'm simply overlooking something.
Any suggestions?
Thanks
EDIT:
Since posting this question, I have tried completely uninstalling Android Studio and performing a clean install of it, Flutter and Dart. However, I have the same result. Older projects have Firebase Assistant and new projects don't.
While trying to figure out the differences between the two projects in the hope of finding something which might explain why one project does have the Firebase Assistant available and new projects do not have Firebase Assistant available, despite having all the same plugins, build.gradle information and pubspec.yaml information, I happened to notice one difference.
In my older projects, the ones that have Firebase Assistant available, if I right click on the project's lib folder and try to add a folder, instead of being able to add a "directory", it gives me the option to add a "package". Here is a screenshot of what it looks like:
However, in my new projects, the menu looks different. It says "directory" instead of "package" as shown here:
I don't know if whatever is different about my projects that is causing one to say "package" and the other to say "directory" is the reason that the project with "package" in the menu has access to Firebase Assistant, while the one with "directory" does not; however, I suspect that it might be.
I haven't been able to find anything that explains why one project would have "package" while another has "directory"; does anyone have an explanation? I would love to test out whether that difference is the reason Firebase Assistant isn't appearing.
You can try to run 'flutter clean', then re-sync the graddle.
I am assuming you are running android studio in administrator mode ? I had problems if I was not in administrator mode.

Firebase Crashlytics For Xamarin iOS- Missing dSYM files

Need Help !!
We are getting caution message on top of the Dashboard in Firebase Crashlytics. We are tried with different technical advises in different forums.
But nothing has worked out for us. We are still seeing the caution message at the top (in red strip) and crashes count is incrementing on every crash but doesn't come to Dashboard.
Here we go with our Firebase Crashlytics integration with project :
We are using Firebase Crashlytics with Xamarin Forms project to record any crashes in Mobile Application.
Since, Firebase Crashlytics SDK & Documentation are mostly on Native Platforms (Android & iOS). But, we still got provision to get packages from NuGet.
Here is the checklist which ensures we are on right direction:
1) Is App released with proper Apple Distribution Provision Profile and Certificate- YES
2) Is Distribution Provision Profile valid in terms expiration date - YES, it is valid till Next year from now.
3) Is GoogleService-Info.plist correctly placed. YES- it was downloaded from Crashlytics console with proper identifier configured. File was placed at root of iOS Project and set Build Action as BundleResource.
4) Did we call required initialisation function at proper place. - YES. Below set of codes ensures we initialised properly Firebase Crashlytics in AppDelegate.cs class.
5) Is your build configuration rightly placed in Release mode. YES
6) Important Point: Firebase Crashlytics was able to process the reported crashes with earlier version of iOS build which were having same project and package configuration and we could able to see the Crashes in readable format till for immediate previous versions.
But suddenly it stopped working when we promoted to production in AppStore (means LIVE in AppStore)
7) Have we uploaded to dSYM file manually to Firebase Crashlytics - YES we TRIED. We followed the steps to upload dSYM using XCode-SWIFT project with POD files.
Here is the setup and step.
POD was installed in appropriate XCode workspaces.
Run Script was executed with recommended POD commands.
Build was succeeded.
Hence, as you see, we are practiced with every advises whichever mentioned in any forum. We have applied, but we don't see, it is coming to Crashlytics Dashboard even then.
Try below command. May be help full.
msbuild "/Users/xxx/projects/myApp/myApp/myApp.iOS/myApp.iOS.csproj" /t:"build" /p:Configuration="AppStore" /p:Platform="iPhone" /p:BuildIpa=true /p:FirebaseCrashlyticsUploadSymbolsEnabled=true
I have tried this command and it is working in my case. I get it from this git thread : https://github.com/xamarin/GoogleApisForiOSComponents/issues/386

Firebase not reporting android activity

We are using Firebase for push notifications for Android and iOS, and all the notifications are working perfectly.
But when I log into firebase, and try to see the activity in “Streamview”, I see only iOS activity, and nothing for Android.
I do see the activity in Cloud messaging’s Report section, for both iOS and Android.
The application we have built is built using Xamarin forms.
One thing to note from the Firebase console is that it doesn’t appear as though the console recognizes that SDK setup was fully complete.
When going into the link where it says “Continue SDK Setup”.
Finally, when proceeding to step #4 it tries to verify that there has been communication between the app and Google’s servers and it doesn’t seem to find anything and it just sits there looking.
Notifications appear to work, but the app just doesn’t seem to be registering as being used under the Android side.
Any pointers in this direction will be very helpful.
i don't have any idea what is wrong here.
I want to watch complete report of my push notifications sending count, for both platform Android and iOS. but i am getting only iOS report in stream view tab not for Android.
I made the comment above and now I have found an answer, at least for my situation. I had added Xamarin.Firebase.Core to the PCL project as the documentation suggests. Later I saw documentation for Android Java that showed Firebase Core being added to the gradle file at the app level. So I added Xamarin.Firebase.Core NuGet package to the Android project also and now I can see data for Android in the Firebase Console.

FCM/GCM for electron APP

I have been using FCM/GCM to send notifications to Chrome App, Chrome Extension, Android APP.
But, may I know how can I send notifications to an electron APP from FCM/GCM. I browsed through a lot of websites but did not find anything related to it.
PS: I don't worry about how the notifications are displayed. I just want the notification payload to be received by the electron app.
Thanks in advance.
There's nothing available out of the box with Electron but there is a Node package available here: https://www.npmjs.com/package/electron-push-receiver
There's no boilerplate code available for using this package yet, but there is an open issue in the associated GitHub project requesting a working example: https://github.com/MatthieuLemoine/electron-push-receiver/issues/8

Resources