Pages

Labels

Sample (14) Intent (5) Media (5) Location (4) Funny (3) HTTP (3) Sleep as Android (3) WiFi (3) Alarm (2) Recording (2) Regexp (2) Array (1) Basic (1) Battery (1) Browser (1) Calculator (1) Contacts (1) Content Provider (1) Cron (1) Dialog (1) Dictionary (1) Export (1) Function (1) GUI (1) Game (1) Loop (1) Random (1) SD Card (1) Social (1) Temperature (1) Text to Speech (1) Weather (1)

Search Scripts

2012-02-19

Sleep as Android: Start App After Alarm Dismiss


// Start an activity after Sleep as Android alarm is dismissed 
// for example synchronize news to read them on the way to work

while (true) {
  waitForIntent("com.urbandroid.sleep.alarmclock.ALARM_ALERT_DISMISS");
  waitForConnectivity();
  // TODO change package to start my app
  startActivity("com.urbandroid.reader");
}

1 comment:

  1. I have a "stop oversleeping captcha" set up and the script runs fine: Alarm rings, I dismiss, the captcha is completed, and the specific app launches.

    However, I'd like to continue is Ng the sleep as Android feature of rating my sleep. ate sleep before the script switches. No biggie, but when I return back to Sleep As Android, the rating screen is not there and instead I have returned to the main alarm screen.i understand I need to modify the "wait for intent", but not sure I how to find the correct intent which signals completion of rating my night's sleep after dismissing the alarm and captcha.

    Looking to learn.. please and thankyou for your help.

    ReplyDelete