Example: Android app, Google Voice integration, push-notifications

Task

This example will show how to integrate Google Voice commands with LogicMachine and how to use push-notifications on your Android device on specific events.

Video tutorial

LogicMachine app is available in Play store. All the rest configuration is the same as in iOS video tutorial.

Push-notification integration

 

Script to send push-notification to specific Android 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 Android devices:

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

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