This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
built_in:app_events [2015/03/07 10:28] octazid add OnAlarm() |
built_in:app_events [2015/03/21 14:52] madlyr Added OnData |
||
---|---|---|---|
Line 11: | Line 11: | ||
|OnConfig() |configuration changes. (eg. When user rotates phone) | | |OnConfig() |configuration changes. (eg. When user rotates phone) | | ||
|OnAlarm() |an alarm previously set by app.SetAlarm() is triggered | | |OnAlarm() |an alarm previously set by app.SetAlarm() is triggered | | ||
+ | |OnData() |data sent by Android Intents | | ||
The code of the sample that is bundled with DroidScript is reproduced below without permission. Hope you don't mind, guys. | The code of the sample that is bundled with DroidScript is reproduced below without permission. Hope you don't mind, guys. | ||
Line 65: | Line 66: | ||
{ | { | ||
app.ShowPopup( " | app.ShowPopup( " | ||
- | } </ | + | } |
+ | |||
+ | //Handle data sent from other apps. | ||
+ | function OnData( isStartUp ) | ||
+ | { | ||
+ | | ||
+ | var intent = app.GetIntent(); | ||
+ | if( intent ) | ||
+ | { | ||
+ | //Extract main data. | ||
+ | var s = " | ||
+ | s += "type: " + intent.type + " | ||
+ | s += "data: " + intent.data + " | ||
+ | |||
+ | //Extract extras. | ||
+ | s += " | ||
+ | for( var key in intent.extras ) | ||
+ | s += key+": " | ||
+ | |||
+ | app.Alert( s, " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </ |