How do I add Firebase Cloud Messaging to Xamarin.Forms app? - android

Google has replaced GCM (Google Cloud Messaging) with the new FCM (Firebase Cloud Messaging) for push notifications. I am trying to implement push notifications in my Android (Xamarin.Forms) project. It appears that FCM is not yet supported for Forms due to Google Play Services dependency issues (see details below). When I attempt to implement using the old GCM system, the Google Developer Console will not allow me access the GCM API credentials page (just redirects me to FCM). Does anyone have any suggestions to get push notifications working with Android in a Xamarin.Forms solution?
Note: I am using Azure Notification Hub to send the messages (I have iOS already working)
Dependency Issue: The latest Xamarin.Forms package is dependent on Xamarin.Android.Support.v4 (23.3.0). Xamarin.Firebase.Messaging is dependent on Xamarin.GooglePlayServices.Basement (32.961.0). Xamarin.GooglePlayServices.Basement (32.961.0) is dependent on Xamarin.Android.Support.v4 (>=24.2.1).

My android solution is on:
https://forums.xamarin.com/discussion/70248/firebase-configuration
Just search for my name as UmutBebek. I'm using pushSharp to send push-notifications from my own server. There is a simple example for that too.

Almost a year later and this should not be an issue anymore.
I have a Xamarin Forms (2.4.0) app pegging Xamarin.Android.Support v4 at version 25.1.0 and I just installed Xamarin.Firebase.Messaging (42.1021.1) happily alongside it via nuget.

Related

How to remove the Firebase Cloud Messaging SDK from Unity?

I want to display an Android notification with a large image whenever I send a notification from FCM (I have included the data payload with a URL for the image). The Android app can be in background or foreground.
I did not know earlier that this is not directly possible with the Unity SDK for FCM. So now I have a Unity project which I'll need to export the project to Android Studio and do something, according to this thread: https://github.com/firebase/quickstart-unity/issues/146#issuecomment-389579086
What I've figured is (maybe I'm wrong) I'll need to remove the FCM SDK from Unity and add the Android SDK in Android Studio and follow the steps for Android. So I deleted all the FCM specific files from my project, reimported other SDKs (Firebase Database, Firebase Auth, Firebase Analytics, Firebase Remote Config, Facebook SDK and GoogleMobileAds SDK) to ensure I didnt break any of these SDKs in the process.
Before exporting to Android Studio, I tried building directly from Unity to make sure I'm making stable builds, but the app crashes as soon as I open it. This is probably happening because the Messaging SDK has irreversibly changed the entry point to a MessagingUnityPlayerActivity, and I have already deleted it.
How do I safely remove the Messaging SDK? Or is there any other solution to my problem?

If the old app using GCM does not have plans to migrate to FCM ,What happens post April 2019?

Does the old app using GCM still work if the app is not migrated to FCM post April 2019 by changing only the server end point to FCM ?
And from the FAQ:
"Note that client SDKs and GCM tokens will continue to work indefinitely. However, you won't be able to target the latest version of Google Play Services in your Android app unless you migrate to FCM."
Does it mean that, at the client side if the app uses GCM services and tries to update/target Google play services released after 2019 April then the app won't compile due to removing of gcm services from play services(com.google.android.gms:play-services-gcm:x.x.x) , so if the app want to use latest version of Google play services , only option is to use FCM as GCM code won't compile .
Is my understanding correct ?
Post April 2019. if the app. does not target latest version of Google play services ,can it submit future versions of app using GCM in playstore without migrating to FCM ?

No clients were able to be added to your Firebase project

I recently released an Android App on the playstore this app is currently linked with both Google's Admob and Google's firebase for analytics, after a while I started working on an update that includes FIREBASE NOTIFICATIONS when I tried to connect firebase to the project I got this error:
Firebase
No clients were able to be added to your Firebase project for the following reasons:
An app with this package name and SHA1 is already connected to a Google project. If you have used a Google API previously, please select that project in the Connect to an existing project list.
Client Package Name: xxxxxxxxxxxxxxxxxxxxxxxxx
Client SHA1: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
How to fix this without loosing my previous analytics stats ?
You Should Use The existing App And Include Feature For Push Notifications at Firebase console or firebase assistant in studio
As you are creating a new project in firebase assistant for push notifications but you have aldready added this app for another services it Wont use two firebase projects for Single application so Make Sure You Are Going With The Past Project which you have done for admob and then go to cloud messaging amd enable it then you will successfully connect
If any errors again i can Help
Thank you
And If You Created Aldready you can import that project into previous project but make sure that you use same firebase account
https://firebase.google.com/support/faq/
Use this link to know about importing projects

Missing 64-bit support / Missing Push Notification Entitlement Phone

I am trying to submit my app and I keep getting this issue. I have updated the Phonegap and cordova but still get his issue. I have also regenerated the app using command line after the update but no luck.
Email below.
Dear developer,
We have discovered one or more issues with your recent delivery for .
Your delivery was successful, but you may wish to correct the
following issues in your next delivery:
Missing Push Notification Entitlement - Your app appears to include
API used to register with the Apple Push Notification service, but the
app signature's entitlements do not include the "aps-environment"
entitlement. If your app uses the Apple Push Notification service,
make sure your App ID is enabled for Push Notification in the
Provisioning Portal, and resubmit after signing your app with a
Distribution provisioning profile that includes the "aps-environment"
entitlement. See "Provisioning and Development" in the Local and Push
Notification Programming Guide for more information. If your app does
not use the Apple Push Notification service, no action is required.
You may remove the API from future submissions to stop this warning.
If you use a third-party framework, you may need to contact the
developer for information on removing the API.
Missing 64-bit support - Beginning on February 1, 2015 new iOS apps
submitted to the App Store must include 64-bit support and be built
with the iOS 8 SDK. Beginning June 1, 2015 app updates will also need
to follow the same requirements. To enable 64-bit in your project, we
recommend using the default Xcode build setting of “Standard
architectures” to build a single binary with both 32-bit and 64-bit
code.
After you’ve corrected the issues, you can use Xcode or Application
Loader to upload a new binary to iTunes Connect.
Regards,
The App Store team
Goto developer site & enable push notification In your ptovisioning profile for production , recompile with latest provisioning profile & resubmit it.
Regarding 64 bit support have you changd active architecture setting from build setting it should be standard atchitecture.
Found out that this is just a warning message. The App got accepted!
Missing Push Notification Entitlement - Did not matter as I did not use the notification functionality.
Missing 64-bit support - You have to have the latest version of phonegap
Thanks for your help guys

I can not connect Google Cloud Messaging to Android client

I'm trying to create a simple example to work with Google Cloud Messaging to Android. I have a php server that is to send a notification android client. I can not understand how the petroleum products in android. I found examples but can not start them. I tried gradle project creation. wrote dependence:
compile 'com.google.android.gms:play-services:6.1.71'
and he found it. but the classes are not available from the library anyway.
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
Android Studio not find and:
GCMBaseIntentService and GCMConfig not find too
I created a project ant. android sdk Extras->Google Play Services and took away the library:
AndroidSDK\extras\google\google_play_services\libproject\google-play-services_lib\libsgoogle-play-services.jar
and connect it. but the same error.
What am I doing wrong? tell me how to set up and connect to the android client Google Cloud Messaging?

Categories

Resources