Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
Owner and Founder. Opencart
We all love to enable the firebase push notification in our android application.
But while looking at the documents and prescribed content, one might be confused many a times as in what exactly is the right approach to send a notification.
In this blog, we will learn two ways of sending a push notification to your android application using firbase push notification.
Now looking at the approaches, the first approach is pretty simple and officially recommended. Lets have a look at this :
Approach 1 :
Well, that’s it . You can now send the Push notification.
APPROACH 2 :
That’s it, the second approach is done.
NOTE: Saving SERVER API KEY in code is not recommended by the FIREBASE.
For getting where exactly thye serverkey is on firebase console ,you can have a look at this screenshot.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Can you share the code you have written?
Only these small changes should do.
If in case these don’t work then you can also try sending these in the notification payload parallel to the data payload only.
For that, you will have to do something like this :
JSONObject data = new JSONObject();
JSONObject notification_data = new JSONObject();
And then use the above-mentioned snippet.
NOTE: 1) The sound to play when the device receives the notification.
Supports “default” or the filename of a sound resource bundled in the app. Sound files must reside in /res/raw/.
2) The notification’s icon.
Sets the notification icon to myicon for drawable resource myicon. If you don’t send this key in the request, FCM displays the launcher icon specified in your app manifest.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.