Firebase local notifications

前端 未结 1 1970
既然无缘
既然无缘 2021-01-16 19:26

Is there any possibility to fire local notification when there is a callback from Firebase ? I\'ve got a problem with threads I guess,

[Firebase setDispatch         


        
1条回答
  •  隐瞒了意图╮
    2021-01-16 19:50

    You can achieve above functionality as follow.

    1 ) observeEventType method is call when any changes occurs in firebase database

    2 ) Implement observeEventType method as follow.

       // Below statement is point to your database.
       let ref = FIRDatabase.database().reference()
    
       ref.observeEventType(.Value,withBlock:{ (snapshot) -> Void in
                print(snapshot.value)
                // Put your local notification code here...
       })
    

    0 讨论(0)
提交回复
热议问题