damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.43k stars 800 forks source link

Add Triggers for broadcast events #221

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:27

Would like to tie a script directly to an OS level event such as 'incoming 
call', where the script is only triggered (run) when the phone starts to 
receive call, not constantly running or cron'd.  The following hooks would be 
excellent, though are not exhaustive. 

onScreenAwake ( the moment after screen lock is turned on/off)

onIncomingPhoneCall ( returns number of the incoming call, current 'state' 
(answered/unconnected etc)

onLocationChange (the location of the phone changed from it's previous 
position. Returns the previous position and the new position

onCopy / onPaste Events.

onGSensorChange: Example when the phone is placed facedown, or faceup, this 
event would fire. Optionally, would have a filter for 'when screen is on/off 
filter to avoid receving events while the phone is in use (or not in use) 
depending on the desired intent.

Original issue reported on code.google.com by Gregory....@gmail.com on 22 Aug 2010 at 1:38

Copied from original issue: damonkohler/android-scripting#407