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. python网络编程-进程间数据通信(Queue,Pipe ,managers)

    一:进程间数据交换方法 不同进程间内存是不共享的,要想实现两个进程间的数据交换,可以用以下方法: Queue,Pipe ,managers 1)Queue,使用方法跟threading里的queue差 ...

  2. Kaggle案例分析1--Bestbuy

    1. 引言 Kaggle是一个进行数据挖掘和数据分析在线竞赛网站, 成立于2010年. 与Kaggle合作的公司可以提供一个数据+一个问题, 再加上适当的奖励, Kaggle上的计算机科学家和数据科学 ...

  3. jenkins主从服务器部署

    当服务器为linux系统但也有部分ios代码,此时就需要添加一个从jenkins以便编译ios代码.或者需要多个job同时编译这时就需要搭建主从服务器. 1.主(master)节点安装jenkins ...

  4. 关于 poScreenCenter 与 poDesktopCenter

    主要是窗体水平方向与垂直方向的的 居中问题,由于水平方向 没有什么,所以不探讨.而垂直方向由于底部有个工具栏,工具栏自身有个高度,所以垂直方向的居中问题,需要探讨下. 结论: poScreenCent ...

  5. SQLSERVER 2008 编辑所有或者任意行

    选中表 右键选择“编辑前200行”,然后选择左上角的 sql图标,然后在右侧的SQL语句去掉 top 200 然后执行查询 就可以编辑所有的行了,可以选择自己需要写SQL,然后查询编辑. 第二种方法: ...

  6. 教您如何进行SQL跨表更新

    SQL跨表更新数据是在使用SQL数据库中比较常用的,下面就将为您详细介绍SQL跨表更新数据的步骤,希望对您学习SQL跨表更新数据有所启迪. 原始数据如下,首先是表结构 A_dept的初始数据 A_em ...

  7. Spark(七)Spark内存调优

    一.概述 Spark 作为一个基于内存的分布式计算引擎,其内存管理模块在整个系统中扮演着非常重要的角色.理解 Spark 内存管理的基本原理,有助于更好地开发 Spark 应用程序和进行性能调优.本文 ...

  8. CF475C. Kamal-ol-molk's Painting

    C. Kamal-ol-molk's Painting time limit per test 2 seconds memory limit per test 256 megabytes input ...

  9. USACO 4.2 Job Processing

    Job ProcessingIOI'96 A factory is running a production line that requires two operations to be perfo ...

  10. hdoj1879 继续畅通工程(Prime || Kruskal)

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1879 思路 这题和hdoj1102很像,图中的有一些路已经修好了,对于这些已经修好的路,我们令还需要修 ...