0

I need to implement push notification to our Android App using Xamarin. Here is the process. We have web version which used by the Manager. The Manager creates and assign job to the driver. The App version is used by the Driver where it shows the list of jobs and processes of job until its complete. So, when the Manager assigned the Job to the Driver in the Web version, it will then notified to the Driver in the App version that "new job is assigned". Basically, both the web and app uses same database then we created an api(REST API in MVC C#) to connect and get data from the db to be used in the mobile app.

Can someone recommend to me which Push notification plugin(a plugin or nuget) should I use to do this? Currently, I have set up Push Notifications through App center & Firebase but not sure how this work.

Thank you.

Jen143
  • 815
  • 4
  • 17
  • 42
  • https://blog.xamarin.com/implementing-push-notifications-android-apps/ – SushiHangover Jan 16 '19 at 05:07
  • but the data I need to be push is from our server not from Firebase. Is there a way I could push our data to Firebase db? – Jen143 Jan 16 '19 at 06:02
  • Hello @Jen143 I would suggest you look into the [firebase cloud messaging](https://firebase.google.com/docs/cloud-messaging/) API that does everything that you are mentioning here if you want i can give you a detailed answer – FreakyAli Jan 16 '19 at 06:32
  • @Jen143 ? "Firebase" is an umbrella brand, one of its components is FCM (Fire Cloud Messaging) and you can embed your data (and/or a notification) in the message and send it to the devices. You do not have to use Firebase DB to use FCM – SushiHangover Jan 16 '19 at 06:39
  • @G.hakim can you please help me and give me a detailed answer? Thanks – Jen143 Jan 16 '19 at 07:01

1 Answers1

2

I need to implement push notification to our Android App using Xamarin.

  • I would suggest you use Firebase for mobile push notifications for Android as it is a product by Google, and was made for mobile applications. For push notifications, you will be using Firebase Cloud Messaging also known as FCM. See to it that you are well versed on how it works before you start coding anything read the documents it answers most of your questions there itself.

The Manager creates and assign job to the driver. The App version is used by the Driver where it shows the list of jobs and processes of a job until its complete. So, when the Manager assigned the Job to the Driver in the Web version, it will then notified to the Driver in the App version that "new job is assigned". Basically, both the web and app use the same database then we created an API(REST API in MVC C#) to connect and get data from the DB to be used in the mobile app.

  • For this, you will have to check on how to work with Firebase using Rest-API. Once you configure the Rest-API and then apply your business logic to it things will be quite easier than you might have imagined.

Can someone recommend to me which Push notification plugin(a plugin or NuGet) should I use to do this?

  • My recommendation is quite simple, Do not use any sort of a firebase push notifications plugin!. I have had a very bad past with plugins and ever since then I never recommend fellow developers to use plugins until it is a well-maintained one. I would rather ask you to simply configure Firebase on the basis of the guides that are available online. Like the following Xamarin.Android guide for FCM. It is detailed contains everything that you are looking for and what else I would suggest is you check firebase related answers on SO and you will find that almost everything that is not available in docs is covered around here and in detail. Like the following:

How to handle Firebase Notification i.e. Notification Messages and Data Messages

Push Notification in android with firebase get token

How to send device to device messages using Firebase Cloud Messaging?

Receive push notifications on one android app from two Firebase projects

FreakyAli
  • 13,349
  • 3
  • 23
  • 63
  • I have sent data to this: https://fcm.googleapis.com/fcm/send provided the appID and senderId and then receive response: {"message_id":8429804111230173352} however I could not see the message in Cloud Messaging in Notification tab in Firebase and did not receive the message in the app as well. – Jen143 Jan 28 '19 at 05:50
  • How exactly are you doing this are you using a web-api? – FreakyAli Jan 28 '19 at 06:41
  • Yes. Web API. When a user make changes to web then it will send notif to app – Jen143 Jan 28 '19 at 06:43
  • Okay so you are not receiving it in your mobile app, in that case, do you get a hit in your OnMessageReceived method? – FreakyAli Jan 28 '19 at 06:45
  • I wonder why i could not see it from the dashboard of Cloud Messaging in the Firebase – Jen143 Jan 28 '19 at 07:02
  • I have the OnMessageReceived method and when I manually created a notification from the Firebase->Cloud Message->New Notification, I could received the message. – Jen143 Jan 28 '19 at 07:05
  • Umm you are missing something in your API may be, I would suggest you ask another question add all your code and we can work through it !! Don't forget to put its link here so I can check it out. Also do not forget to add all the relevant code, it must be some small mistake we can work through it – FreakyAli Jan 28 '19 at 07:05
  • I have asked it here: https://stackoverflow.com/questions/54396362/push-notification-from-web-data-to-mobile-app-using-fcm – Jen143 Jan 28 '19 at 07:06
  • Okay let me check it out – FreakyAli Jan 28 '19 at 07:09