http://webmail.dev411.com/t/gg/tasker/12bdddbsak/a-profile-to-detect-when-a-sms-has-been-sent

A belated reply. My solution below [let Tasker know when an SMS was sent]
follows Pent's outline.

Prereqs - you must:

0. be root
0. have sqlite3 installed
0. locate your message database (mmssms.db). Most likely this is in
</data/data/com.android.providers/telephony/databases/mmssms.db>

1. Create a Profile with the context of Application - Messages (or whichever SMS apps you care about).

2. On-entry task:
  2a.- Script Action, Run Shell, Command:
       - sqlite3 [your message db full path] SELECT MAX(_id) FROM sms ;
       - store output in %PrevMaxMsg

3. On-exit task:
  3a.- Script Action, Run Shell, Command:
       - sqlite3 [your message db full path] SELECT MAX(_id) FROM sms ;
       - store output in %NowMaxMsg
  3b. - If %PrevMaxMsg !~ %NowMaxMsg:
      3c. - [your actions]

This works because the mmssms.db database contains a table (sms) which
holds the details of sms and mms messages drafted, sent, received and
failed. Getting and comparing MAX(_id) on entry and exit lets you know if a
new message has been created.

4. Note with this approach "[your actions]" will also occur for a drafted,
unsent message - this may be undesirable. For more granularity:
   - replace the SQL queries in 2a and 3a with something like "SELECT type,
COUNT(*) FROM sms GROUP BY type ;"
   - This results in "1|47 2|43 3|1 6|1", which are message states and
counts "1. Inbox (Received) = 47; 2. Sent = 43; 3. Draft = 1; 6. Queued
(for Send) = 1". These counts could be used to drive different behaviours.
   - I understood the message states from
<https://github.com/android/platform_frameworks_base/blob/ics-mr1-release/core/java/android/provider/Telephony.java>

A profile to detect when a SMS database has been changed的更多相关文章

  1. The model backing the <Database> context has changed since the database was created.

    Just found out the answer and thought of updating here. Just need to do the following. public class ...

  2. [Hive - LanguageManual] Create/Drop/Alter Database Create/Drop/Truncate Table

    Hive Data Definition Language Hive Data Definition Language Overview Create/Drop/Alter Database Crea ...

  3. Deploying Customizations in Oracle E-Business Suite Release 12.2

    DeployingCustomizations in Oracle E-Business Suite Release 12.2 This documentdescribes how to deploy ...

  4. IBM DB2 SQL error code list

    SQL return codes that are preceded by a minus sign (-) indicate that the SQL statement execution was ...

  5. C# - 缓存OutputCache(一)基础配置

    本文是通过网上&个人总结的 1. 介绍 OutputCache输出缓存是复制ASP.NET页面,保存在内存的机制.这种行为有助于提高性能,通过返回的缓存达到网页及时响应的目的,减少客户机器需要 ...

  6. 【转】MongoDB安全配置

    [转自]http://drops.wooyun.org/%E8%BF%90%E7%BB%B4%E5%AE%89%E5%85%A8/2470 0x00 MongoDB权限介绍 1.MongoDB安装时不 ...

  7. OutputCache概念学习

    目录 OutputCache概念学习 OutputCache属性详解(一) OutputCache属性详解(二) OutputCache属性详解(三) OutputCache属性详解(四)— SqlD ...

  8. SQL调优 - Hints指定索引 解决慢查询案例

    背景 每当交易高峰时期,可能会暴露一些平时无法发现的问题,机遇和挑战并存.下面聊聊最近解决的一个案例,因为执行计划走错导致慢查询,进而引发应用线程阻塞.线程池爆满,最后应用功能瘫痪.如何标本兼治的解决 ...

  9. ASP.NET缓存全解析2:页面输出缓存 转自网络原文作者李天平

    页面输出缓存是最为简单的缓存机制,该机制将整个ASP.NET页面内容保存在服务器内存中.当用户请求该页面时,系统从内存中输出相关数据,直到缓存数据过期.在这个过程中,缓存内容直接发送给用户,而不必再次 ...

随机推荐

  1. MyEclipse文本对比界面样式修改

    MyEclipse刚安装好,使用文件对比的时候,发现两边的对比颜色非常浅,不同的地方不容易发现,可以通过以下配置将显示颜色调深一点. 配置 效果

  2. python基础学习之路No.2 数据类型

    python中常见的数据类型有:整数.浮点数.字符串.列表.元组.字典 python相较其他语言,可以省略了声明,可以直接定义赋值使用. 例如: a=12 就相当于 其他语言中的  int a=12  ...

  3. 2018JAVA复习摘要

    由于公司内部原因,2018年感觉自己可能会换个新环境:虽然时间尚未确定,但还是得提前做好防范,毕竟面试复习是需要时间好好准备才能拿到自己理想的offer.打算从清明节之后开始好复习基本知识要点,先整理 ...

  4. Java I/O系列汇总

    1.Java I/O---概述 2.Java I/O---File类 3.Java I/O---获取文件目录并写入到文本 4.Java I/O---输入与输出 5.Java I/O---复制文本文件 ...

  5. 让你的 JMeter 像 LoadRunner 那样实时查看每秒事务数(TPS)、事务响应时间(TRT)

    熟悉 LoadRunner 的朋友一定不会对其 TPS(每秒事务数).TRT(事务响应时间) 等视图感到陌生,因为这是压力测试最为关键的两个指标.JMeter 以其开源.轻巧.灵活.扩展性高等特性赢得 ...

  6. Rewrite HTTP to HTTPS in Nginx

    1.推荐配置 server { listen 80; server_name example1.com example2.com; return 301 https://$host$request_u ...

  7. C#连接mariadb代码及方式

    不负责任的说MariaDb和MySQL很多都是通用的,因为来自同一个爹... 和MySQL连接方式差不多 首先配置好你的MariaDb,创建test数据库,在test里创建MyTable表,脚本如下( ...

  8. 开源框架:SDWebImage

    http://blog.csdn.net/uxyheaven/article/details/7909373 SDWebImage是我搞iOS以来少数佩服的框架,膜拜一下作者.真的写的非常棒! 这套开 ...

  9. centos7.3 chrome 安装

    /etc/yum.repos.d/目录下新建文件google-chrome.repo,向其中添加如下内容: [google-chrome] name=google-chrome baseurl=htt ...

  10. day4 计算器

    作业:计算器开发 (1)实现加减乘除及拓号优先级解析: (2)用户输入 1 - 2 * ( (60-30 +(-40/5) * (-9-2*5/-3 + 7 /3*99/4*2998 +10 * 56 ...