2

I am developing an Android app, which deals with allocating orders to multiple suppliers. Each supplier will have the same Android app installed. Every day, the in charge of the suppliers will open the app, pick up the suppliers to assign from the recyclerview and enter a customised message on the days' supply in an editText.

The message should be delivered in form of push notification to other suppliers he has selected from the recyclerview. So, in this case I cannot use Firebase console to send notifications. I initially thought of using Twilio to do this. But my client wanted to keep this as last option. They want me to try Push notifications.

I am researching, but every one is illustrating on how the notification can be sent through Firebase console. I also heard that GCM is obsolete now.

Please can anyone give me some pointers on how this can be done? Please note that I am a beginner in Android.

1 Answer 1

1

I think you can use firebase cloud messaging to achieve this. See FCM documentation.

You can send a push notification through firebase by using firebase HTTP protocol instead of the firebase console. In this way, you can programmatically send a push notification by making a REST call. There are 2 firebase HTTP protocols that you may use to achieve this:

  1. Legacy protocol: This is the older firebase HTTP protocol. This is easier to set up and you can find a lot of material online explaining how to use this like medium article.
  2. New protocol(HTTP V1): This is the newer HTTP protocol. This is a little more difficult as authentication is done by oAuth token. However, this is more secure and extensible. Also, it seems like firebase might eventually deprecate the legacy API.

Hence, in your app, once the in charge of suppliers assigns the duties, you can call the firebase APIs to send out push notifications to all the assigned suppliers.

6
  • Thanks for your help Derryl. I will check this today and let you know. Thanks again
    – DBHari
    Oct 24, 2019 at 6:15
  • @DBHari, were you able to achieve what you wanted with FCM? Nov 5, 2019 at 12:01
  • Hi Derryl, Apologies for the delay. No I could not achieve. I used node.js, implemented the push notification using firebase admin SDK. it sends notification independently when I pass the token. But, I dont know how to use this from Android. I searched everywhere including stackoverflow. But could not find an answer. Hence I have used smsSend method in BroadcastReceiver class in android. However, I still would like to use that node.js . By any chance do you know to use this? Thanks for asking. Much appreciated
    – DBHari
    Nov 6, 2019 at 13:49
  • @DBHari, you only need to make a REST call to the above firebase APIs with your payload. I do not understand why you need node.js here. You may use a REST client like retrofit to make REST calls easily - medium.com/@prakash_pun/… Nov 6, 2019 at 14:52
  • Hi Derryl, thanks for your comment. problem is I am totally new to android & REST. I started off with my little knowledge in Java, going through the forums like this and then building the app. I used node.js because I tried to implement push notification with fcm admin sdk and java class. problem is I dont know which app server to use. I could not find anything which says how to implement the libraries or classes in an app server and initiate from android app. After your comment, let me go through the link and get back to you. Give me a day. Thanks again for your help. Much appreciated
    – DBHari
    Nov 6, 2019 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.