Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Premium Land with House for Sale
anil1961
Updated:
Yesterday at 10:15 AM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Wednesday at 8:16 PM
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Tuesday at 10:57 AM
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Tuesday at 10:55 AM
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Tuesday at 10:53 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Help ekak one Android programming waddek gen..........
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Chandi_Bandi" data-source="post: 27983234" data-attributes="member: 557924"><p>Machanla mekai case eka, campus eke final project eka, garbage bin collect karana project ekak. mama android danne naha, yaluwekta kiyala hada gatte,</p><p>eke firebase function eken push notification ekak yanawa garbage bin eka full nam. mata one e notification ekata interval ekak set kara ganna. danna kenek innawa nm help ekak dihallako...............</p><p></p><p>[CODE]const functions = require('firebase-functions');</p><p>const admin = require('firebase-admin');</p><p></p><p>admin.initializeApp();</p><p></p><p>var msgData;</p><p></p><p>exports.SendNotification = functions.database.ref()</p><p> .onUpdate((snapshot, context) => {</p><p> var newval = snapshot.after.val();</p><p> if (newval.precent >= 20 && newval.status == false) {</p><p> var payload = {</p><p> "notification": {</p><p> "title": "Smart Bin Collect",</p><p> "body": "Bin is full , now you can collect garbage bin " + newval.name,</p><p> "sound": "default"</p><p> }</p><p> }</p><p> //create topics</p><p> var topics = "notification"</p><p> </p><p> return admin.messaging().sendToTopic(topics, payload).then((response) => {</p><p> console.log('Pushed them all');</p><p> }).catch((err) => {</p><p> console.log(err);</p><p> });</p><p> }</p><p> log(newval.precent);</p><p> //Your notification code here</p><p> });[/CODE]</p></blockquote><p></p>
[QUOTE="Chandi_Bandi, post: 27983234, member: 557924"] Machanla mekai case eka, campus eke final project eka, garbage bin collect karana project ekak. mama android danne naha, yaluwekta kiyala hada gatte, eke firebase function eken push notification ekak yanawa garbage bin eka full nam. mata one e notification ekata interval ekak set kara ganna. danna kenek innawa nm help ekak dihallako............... [CODE]const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(); var msgData; exports.SendNotification = functions.database.ref() .onUpdate((snapshot, context) => { var newval = snapshot.after.val(); if (newval.precent >= 20 && newval.status == false) { var payload = { "notification": { "title": "Smart Bin Collect", "body": "Bin is full , now you can collect garbage bin " + newval.name, "sound": "default" } } //create topics var topics = "notification" return admin.messaging().sendToTopic(topics, payload).then((response) => { console.log('Pushed them all'); }).catch((err) => { console.log(err); }); } log(newval.precent); //Your notification code here });[/CODE] [/QUOTE]
Insert quotes…
Verification
Hathara warak wissa keeyada? (Hathara wadi karanna 20)
Post reply
Top
Bottom