A profile to detect when a SMS database has been changed

it2022-05-15  68

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 root0. have sqlite3 installed0. 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 %PrevMaxMsg3. 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) whichholds the details of sms and mms messages drafted, sent, received andfailed. Getting and comparing MAX(_id) on entry and exit lets you know if anew 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 andcounts "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>

 

转载于:https://www.cnblogs.com/shangdawei/p/4509989.html

相关资源:DirectX修复工具V4.0增强版

最新回复(0)