Example: iOS Siri integration and push-notifications

Task

This example will show how to integrate Siri voice commands with LogicMachine and how to use push-notifications on your iOS device on specific events.

Video tutorial

Push-notification integration

 

Script to send push-notification to specific iOS device:

Source code    
  1. pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")
  2.  
  3. status, errors = pusher.push_notification('08a7a67cc15d5325c0bbaffbd1106c0e5a914b8ea6e850f4210a4a2cd260c835', 'Test Message')
  4. log(status, errors)

Script to send push-notifications to all iOS devices:

Source code    
  1. pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")
  2.  
  3. local ids= {}
  4. for _, d in ipairs(pusher.get_ios_devices()) do
  5. table.insert(ids, d.id)
  6. end
  7. local status,errors = pusher.push_notification(ids, 'Your house is on FIRE!')
  8. log(status,errors)

Here you can download FB editor libraries for push-notifications. Install it through Scripting -> User libraries -> Restore