A profile to detect when a SMS database has been changed
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的更多相关文章
- 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 ...
- [Hive - LanguageManual] Create/Drop/Alter Database Create/Drop/Truncate Table
Hive Data Definition Language Hive Data Definition Language Overview Create/Drop/Alter Database Crea ...
- Deploying Customizations in Oracle E-Business Suite Release 12.2
DeployingCustomizations in Oracle E-Business Suite Release 12.2 This documentdescribes how to deploy ...
- IBM DB2 SQL error code list
SQL return codes that are preceded by a minus sign (-) indicate that the SQL statement execution was ...
- C# - 缓存OutputCache(一)基础配置
本文是通过网上&个人总结的 1. 介绍 OutputCache输出缓存是复制ASP.NET页面,保存在内存的机制.这种行为有助于提高性能,通过返回的缓存达到网页及时响应的目的,减少客户机器需要 ...
- 【转】MongoDB安全配置
[转自]http://drops.wooyun.org/%E8%BF%90%E7%BB%B4%E5%AE%89%E5%85%A8/2470 0x00 MongoDB权限介绍 1.MongoDB安装时不 ...
- OutputCache概念学习
目录 OutputCache概念学习 OutputCache属性详解(一) OutputCache属性详解(二) OutputCache属性详解(三) OutputCache属性详解(四)— SqlD ...
- SQL调优 - Hints指定索引 解决慢查询案例
背景 每当交易高峰时期,可能会暴露一些平时无法发现的问题,机遇和挑战并存.下面聊聊最近解决的一个案例,因为执行计划走错导致慢查询,进而引发应用线程阻塞.线程池爆满,最后应用功能瘫痪.如何标本兼治的解决 ...
- ASP.NET缓存全解析2:页面输出缓存 转自网络原文作者李天平
页面输出缓存是最为简单的缓存机制,该机制将整个ASP.NET页面内容保存在服务器内存中.当用户请求该页面时,系统从内存中输出相关数据,直到缓存数据过期.在这个过程中,缓存内容直接发送给用户,而不必再次 ...
随机推荐
- Python_oldboy_自动化运维之路_全栈考试(七)
1. 计算100-300之间所有能被3和7整除的所有数之和 # -*- coding: UTF-8 -*- #blog:http://www.cnblogs.com/linux-chenyang/ c ...
- AdvStringGrid 垂直居中 、水平居中
官网faq,解答: 结果:
- Codeforces 946D Timetable(预处理+分组背包)
题目链接:http://codeforces.com/problemset/problem/946/D 题目大意:有n个字符串,代表n天的课表,1表示这个时间要上课,0表示不要上课,一天在学校时间为第 ...
- (二)Jsoup 查找 DOM 元素
第一节: Jsoup 查找 DOM 元素 getElementById(String id) 根据 id 来查询 DOM getElementsByTag(String tagName) 根据 tag ...
- (二)HtmlUnit 使用
第一节: htmlunit 模拟浏览器请求 第二节: htmlunit 获取指定元素 第三节: htmlunit 使用代理 IP 第四节: htmlunit 取消 css,javascript 支持 ...
- Python输入/输出
1.在python2.x中raw_input( )和input( ),两个函数都存在,其中区别为 raw_input( )---将所有输入作为字符串看待,返回字符串类型 input( )-----只能 ...
- Java小实验之数据转换
看到有人问如图的程序,就去写了几行代码,顺便复习一下条件语句和ASCII码 import java.util.Scanner; public class test1 { public static v ...
- scrapy-redis 更改队列和分布式爬虫
这里分享两个技巧 1.scrapy-redis分布式爬虫 我们知道scrapy-redis的工作原理,就是把原来scrapy自带的queue队列用redis数据库替换,队列都在redis数据库里面了, ...
- s12-day01-work01用户登录接口
README # README.md # day001-work-1 @南非波波 功能实现:登录接口 流程图: ![](http://i.imgur.com/61eFd0u.jpg) 程序实现: 1. ...
- Python全栈开发之16、jquery
一.查找元素 1.选择器 1.1 基本选择器 $("*") $("#id") $(".class") $("ele ...