[Android Apps and Games] strictlyrude27:
ABSTRACT (i.e., TLDR version)

I present a way to integrate Texter; Tasker; a preferred SMS app that also gives popup notifications; and SL4A+Perl such that when using Texter, I can mark incoming SMS as read; clear notifications; clear popups; and re-sleep the phone. Profiles+scripts in the second post.

INTRODUCTION

In a nutshell: I wanted to use Tasker to remove notifications of unread SMS messages while using Texter. This proves difficult because I use an SMS app that has popup notifications. These profiles+scripts exit the popup notification, clear the unread notification, then puts your phone back to sleep.

Texter is an Android app/Google Chrome extension that lets you send SMS messages from your computer with your phone number. Super cool! It's kind of glitchy at times but overall a solid app, and it'll get better with time. It's currently in closed beta but they're adding new people all the time. I'd hop on that ASAP.

Texter clears unread SMS notifications when you hit "Close" or "Reply", but by Android design it cannot clear the notification bar and LED. I keep my phone on my desk when using my computer, so having the unread notification on both my phone and my computer are kind of annoying. So I wanted to use Tasker to clear those notifications. Turns out Tasker cannot mark messages as read itself, so I use SL4A and the Android port of my favorite scripting language, Perl. It's easy to write a script using SL4A and Perl for Android (or your language of choice - but I provide a Perl script, so you may as well use that) to clear unread SMS notifications for you.

OVERVIEW OF PROFILES

This first post will be a discussion of each profile I use; next post will have the profiles/scripts themselves, and possibly a changelog as I mess around with this system.

My system consists of 5 profiles and 1 widget-task:

WIDGET-TASK: USE TEXTY

This task simply sets or clears a variable %TEXTY, to denote if we are at a computer and would prefer to use Texter vs our phones to send SMS messages. It also sets a permanent notification and changes the widget icon to show that you're in Texter-mode vs regular SMS mode.

PROFILE: TEXTY ACTIVE

This is the heart and soul of the profile scheme. When you receive an SMS, if %TEXTY is set it fires the Perl script that clears your SMS notification, then opens your preferred SMS app to clear the notification bar. Bonus: if you use a popup SMS notification (GO SMS, Handcent, Chomp, etc), this will also clear the popup for you!

PROFILE: TEXTY DISPLAY ON/OFF

Naively using %SCREEN to denote if the screen is on/off to enable or disable Texter functionality does not work all the time - I have found that my phone sometimes lags between receiving a text message and actually popping up the notification. So if %SCREEN ~ on, the main profile might not fire the go-back-to-sleep tasks.

Thus we need a way to account for this lag. I created a new variable %TEXTYSCN that denotes when the screen is on/off, accounting for that lag. Basically, I wait 15 seconds after screen on before setting %TEXTYSCN = on; if the screen has been on for that long, it's probably because I wanted to use it.

When I set %TEXTYSCN = off, I wait 15 seconds beforehand IF IT'S ALREADY SET TO OFF. This seems weird at first, but it's kind of like an interrupt handling mechanism - if you receive a text, your screen will turn on. That starts the 15 second count before %TEXTYSCN = on - until those 15 seconds are up, %TEXTYSCN ~ off. Now that the popup notification is cleared, the display shuts off. If we flipped %TEXTYSCN = off right now and we're inside that 15 second timer, %TEXTYSCN will get set back to on - and subsequent popup notifications won't get cleared. Note that I only wait if %TEXTYSCN ~ off. If it's on, that means we're choosing to sleep the phone after we've used it for something.

[NOT SURE IF NEEDED, NEEDS MORE TESTING] PROFILE: PHONE OFFHOOK/IDLE

Not sure if I need these profiles yet - all it does is disable the main profile if we're on a call, and restart it once we hang up. GO SMS doesn't popup notify when I'm in a call, and after a call I can clear the notifications as I please. I'm not entirely sure of using the main profile during calls yet (what happens if I get a text in the middle of a call and my screen was off at the time? It'll run the main profile, GO HOME, then display off. This might be disorienting the next time I look down and I'm at the Home screen rather than the In-Call screen) so I'll just disable the clear-SMS. Maybe in a later iteration I'll disable the go-home part but clear SMS.

ON TO POST #2!