Before you can use FCM services in your app, you must create a new project (or import an existing project) via the Firebase Console. Use the following steps to create a Firebase Cloud Messaging project for your app:
In the Create a project dialog, enter the name of your project and click CREATE PROJECT. In the following example, a new project called YourProjectName is created:
In the Firebase Console Overview, click Add Firebase to your Android app:
A Server API key and a Client ID are automatically generated for the app. This information is packaged in a google-services.json file that is automatically downloaded when you click ADD APP. Be sure to save this file in a safe place.
In Firebase Cloud Messaging, you specified a package name for the FCM-enabled app. This package name also serves as the application ID that is associated with the API key. Configure the app to use this package name:
Open the properties for your project.
In the Android Manifest page, set the package name.
In Visual Studio, right-click References > Manage NuGet Packages.
Click the Browse tab and search for Zebble.PushNotification.
Install this package into your project.
The next step is to add the google-services.json file to the root directory of your project:
Copy google-services.json to the project folder.
Add google-services.json to the app project (click Show All Files in the Solution Explorer, right click google-services.json, then select Include in Project).
Select google-services.json in the Solution Explorer window.
In the Properties pane, set the Build Action to GoogleServicesJson (if the GoogleServicesJson build action is not shown, save and close the Solution, then reopen it):
Add the following to your web.config of your server application (API):
<add key="PN.Google.AuthToken" value="Your_Server_Key" />
These two values will be avaialable in your project Settings > Cloud Messaging section of Firebase Console:
An Android application must have the following permissions configured before it can receive notifications from Google Cloud Messaging:
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="Package Name" />
For push notification to work properly on Android devices, you need to Clean/Rebuild the Solution and then delete obj and bin folders inside the Android project.