In this post of Python django with Google Firebase series I will show you how to setup and configure Firebase cloud messaging on Python Django.
Insights:
If we want to send a push-notification to an android app then one the best way is to use Firebase cloud messaging, we can setup a manual push-notification to Android app using Firebase console but sending a automated push-notification sometimes becomes a vary cramp-breaking task. Here, we’ll integrate automated push-notification on python django based “Employee Daily Progress Reporting Web App“.
Work Flow Intro :
From, last 7 posts, we are working on a Python Django based web-app in which we are using Firebase as a Back-end support, we have created post/video tutorials for each Firebase functionality, integrated in our Web-App. If we talk about current status, till now we have come a very long way as we integrated following functionalities in our web app :
- Firebase Authentication : SignIn, SignUp, Logout, Session
- Firebase Database : Push Data/ Retrieve Data | Secure Database Rules
- Firebase Storage : Store Image/Files | Retrieve Images/Files
Now, with these functionalities Employee can create a report and Retrieve created reports along with images, but there is a requirement of sending automated push-notification to admin android app once a report is created. So, i hope you guys are clear with requirement of Integrating FCM with my Python Django web app. Let’s see a step by step guide :-
If you like videos like this consider donating $1, or simply turn off AdBlocker. Either helps me to continue making tutorials.
Code below follows the video to help :
Setting Up Firebase Console for FCM :
Setting Up Pusher Beams (Pusher Notifications) :
Django Code :
Views.py
def push_notify(name,progress,work): from pusher_push_notifications import PushNotifications | |
pn_client = PushNotifications( | |
instance_id='be2dce08-9b23-4a81-a72b-fab39797530c', | |
secret_key='0D2A5BABBF132520C4CF8FB9C165D12', | |
) | |
response = pn_client.publish( | |
interests=['hello'], | |
publish_body={'apns': {'aps': {'alert': 'Report Created'}}, | |
'fcm': {'notification': {'title': str(name), 'body': 'Progress: '+str(progress) +" work: " +str(work) }}} | |
) | |
print(response['publishId']) |
Android Code :
App/Build.gradle
compile ‘com.pusher:push-notifications-android:0.9.12‘ compile ‘com.google.firebase:firebase-messaging:10.0.1‘
|
just information we only provide information for those who need it
Happy Valentines Day Love 2019
Valentine's day, the day of love, which falls on 14th February every year is celebrated by the couple all across the globe. Here is the world famous valentine day website visit here: Happy Valentine’s Day Love
Swagg Sauce, manufacturer of the finest premium vape juice and salt nicotine ingredients crafted with our signature flavor blends and eliquid online. Premium grade vape juice, candy, cream, custard, dessert, fruit, tobacco, menthol and more info click here https://buycheapvapecoilsnow989310935.wordpress.com/
awesome article, Thanks Kavin
It's late finding this act. At least, it's a thing to be familiar with that there are such events exist. I agree with your Blog and I will be back to inspect it more in the future so please keep up your act. cloud torrent clients
These is good for android application.. but if i wanna use it for web app then what can i do..?
any suggestions?