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页面内容保存在服务器内存中.当用户请求该页面时,系统从内存中输出相关数据,直到缓存数据过期.在这个过程中,缓存内容直接发送给用户,而不必再次 ...
随机推荐
- local class incompatible: stream classdesc serialVersionUID = -2897844985684768944, local class serialVersionUID = 7350468743759137184
local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = 2427 ...
- SpringCloud常用注解
一 @EnableDiscoveryClient,@EnableEurekaClient的区别 SpringCLoud中的“Discovery Service”有多种实现,比如:eureka, con ...
- Animate.css 前端动画开发教程
1.首先下载animate.css文件: 2.打开动画预览地址选择想要的动画,地址:https://daneden.github.io/animate.css/ ,选择好后记住动画的名字在你下载的a ...
- sql中多层循环示例(有游标)
在需求处理中,我们会遇到需要通过SQL多层循环来处理的问题.如:A表中有8条数据,B表中有10条数据,需要实现A表中的每1条数据对应B表中的10条数据,最后就有了80条数据,从而实现一对多的关系.那如 ...
- Python 的內建模块
>>> import __builtin__>>> dir(__builtin__)['ArithmeticError', 'AssertionError', 'A ...
- Visual Studio 2017 百度云下载
链接: https://pan.baidu.com/s/1kFjGwyj5HwabvmJKiyLF_g 提取码: 关注公众号[GitHubCN]回复获取 秘钥Enterprise:NJVYC-BM ...
- Linux学习笔记——基于鸟哥的Linux私房菜
Linux学习笔记--基于鸟哥的Linux私房菜 ***** ARM与嵌入式linux的入门建议 (1) 学习基本的裸机编程:ARM7或ARM9,理解硬件架构和控制原理 (这一步是绝对的根基) (2) ...
- Signalr信息推送
前序 距离上次写文章,差不多已经大半年了.感觉自己越来越懒了,即使有时候空闲下来了,也不想动.前面买了一系列的Python的书,基础的看了大概有四分之一,剩下的基本上还未动,晚上回去也只是吃饭看电影. ...
- 安卓RecylerView嵌套和事件处理
最近遇到了一个需求:RecylerView的某一项为listView,即listView嵌套,且要求内部ListView可以滑动,高度固定. 如果直接简单的写完,会发现有两个问题: 1.内部listV ...
- C++ shared_ptr
晕晕乎乎,其他的再补充 1.shared_ptr 主要是为了方便管理内存而存在的,C++程序中不会再出现new 和 delete,内存的分配和析构全部由shared_ptr进行管理 2.当程序中对某个 ...