Obtain Current Ringtone and Notification Sound Values

273 views
Skip to first unread message

JB

unread,
Sep 17, 2013, 5:44:41 PM9/17/13
to tas...@googlegroups.com
I'm trying to create a scene that displays the current value for the ringtone and notification sounds.

I don't see any way to grab the values (the name of the assigned ringtone).  I can obviously set the values to a desired ringtone and/or notification, but I'd like to instead just display their current values.

Any suggestions if this possible?

~ JB

PC

unread,
Sep 17, 2013, 6:03:06 PM9/17/13
to tas...@googlegroups.com
This isn't a complete answer for your question, but I use Zooper Widget to display Tasker information, including variable values, running profiles, etc, in a widget on one of my home screens.  You can find it here:


That's the free version, there is also a paid one.

Hope that helps!

Pent

unread,
Sep 18, 2013, 4:47:12 AM9/18/13
to tas...@googlegroups.com
Those aren't available directly via Tasker, sorry. I'll put that on the todo list however.

Pent

nanobrain

unread,
Sep 18, 2013, 8:57:07 AM9/18/13
to tas...@googlegroups.com
It can  be done, but it's a little complicated :). A sqlite query on the com.android.providers.settings settings.db database SELECT VALUE FROM system WHERE name = 'ringtone' (or notification). That returns you an URI (in the form content://media/internal/audio/media/somenumber) Using that somenumber you need to query the com.android.providers.media database where in the "files" table the value of the id=somenumber contains the path to the actual file. 

Hope that gets you on the right path (pun intended).

Nicholas Johnson

unread,
Aug 10, 2015, 4:20:22 PM8/10/15
to Tasker
Can anyone give me some more details on this?  I can test the db and get a good return, but when I run the query, it errors out.

nanobrain

unread,
Aug 10, 2015, 4:46:04 PM8/10/15
to Tasker
http://www.reddit.com/r/tasker/comments/2j8nae/help_retrieving_current_ringtone_value/

There is now probably a java way, but I am no java expert

Plepleus

unread,
Aug 10, 2015, 6:31:32 PM8/10/15
to Tasker

Plepleus

unread,
Aug 10, 2015, 6:35:00 PM8/10/15
to Tasker
and change 1 to a 2 to get notification rather than ringtone.

Nicholas Johnson

unread,
Aug 11, 2015, 11:04:33 AM8/11/15
to Tasker
Thanks to both of you.  I am still getting errored out.  Would a locked bootloader prohibit these queries?  I am rooted, but the boatloader on my phone (Turbo) has yet to be unlocked.

nanobrain

unread,
Aug 11, 2015, 12:15:27 PM8/11/15
to Tasker
I don't think the locked bootloader is what the issue here is. Do you actually have the sqlite3 binary on your phone (it doesn't come with it by default, one way is to take the one that comes with Titanium backup). It would also help if you post the DESCRIPTION (not XML) of your task here.

Nicholas Johnson

unread,
Aug 11, 2015, 2:57:54 PM8/11/15
to Tasker
Thanks again for your help. 

I am not sure if the SQLite binaries are installed.  I've installed titanium backup, per your suggestion and not had any luck.  I also installed an app that is supposed to add the binaries.  The app failed twice, but said sqlite was installed on the third try, after reboot.  The task stilled failed though.  I rebooted once more, and it still failed.  I am on a Droid turbo, android 5.1 rooted, but with a locked bootloader.  The app "SQLite Debugger" works, and find information, but I can't make much sense of it.  It shows:

SELECT * FROM system WHERE name = 'ringtone'
_ID NAME   VALUE
913 ringtone content://media/external/audio/media/3266

I'm presuming that this some how identifies the particular file reference.

Here is the task description:
Query2 (146)
A1: Run Shell [ Command:sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT value FROM system WHERE name='ringtone'" Timeout (Seconds):0 Use Root:On Store Output In:%rturi Store Errors In:%rtqerror Store Result In: ]
A2: Flash [ Text:%rtqerror Long:Off ]
A3: Variable Split [ Name:%rturi Splitter:/ Delete Base:Off ]
A4: Run Shell [ Command:sqlite3 /data/data/com.android.providers.media/databases/internal.db "SELECT title FROM files WHERE _id=%rturi(<)" Timeout (Seconds):0 Use Root:On Store Output In:%rtname Store Errors In:%rtqerror Store Result In: ]
A5: Flash [ Text:%rtname
%rtqerror Long:Off ]



Here is the log:
14.26.20/E Run Shell: %rturi -> %rturi
14.26.20/E Run Shell: %rtqerror -> %rtqerror
14.26.20/E Run Shell:  ->
14.26.20/Shell runBackground sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT value FROM system WHERE name='ringtone'" root: true timeout: -1
14.26.20/Shell start process-thread ID 104
14.26.20/E add wait type Shell7 time 2147483647
14.26.20/E add wait type Shell7 done


Would the place where my ringtones are stored effect the outcome?  I have a separate folder on my SD where rintones are stored.  Each time my phone rings, tasker goes out and picks a new one at random.  Occasionally, the task fails and no ringtone is assigned.  I was looking for a way for Tasker to check to see if one was assigned or not, and if not, run the ringtone task changer again.

Nicholas Johnson

unread,
Aug 11, 2015, 3:01:24 PM8/11/15
to Tasker
OK.  I got Tasker to flash the error, and I think I am having issues installing SQLite:

The error I get is: tmp-mksh:<stdin>[2]:sqlite2:not found


On Tuesday, August 11, 2015 at 2:57:54 PM UTC-4, Nicholas Johnson wrote:
Thanks again for your help. 

I am not sure if the SQLite binaries are installed.  I've installed titanium backup, per your suggestion and not had any luck.  I also installed an app that is supposed to add the binaries.  The app failed twice, but said sqlite was installed on the third try, after reboot.  The task stilled failed though.  I rebooted once more, and it still failed.  I am on a Droid turbo, android 5.1 rooted, but with a locked bootloader.  The app "SQLite Debugger" works, and find information, but I can't make much sense of it.  It shows:

SELECT * FROM system WHERE name = 'ringtone'
_ID NAME   VALUE
913 ringtone content://media/external/audio/media/3266

I'm presuming that this some how identifies the particular file reference.

Here is the task description:
Query2 (146)
A1: Run Shell [ Command:sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT value FROM system WHERE name='ringtone'" Timeout (Seconds):0 Use Root:On Store Output In:%rturi Store Errors In:%rtqerror Store Result In: ]
A2: Flash [ Text:%rtqerror Long:Off ]
A3: Variable Split [ Name:%rturi Splitter:/ Delete Base:Off ]
A4: Run Shell [ Command:sqlite3 /data/data/com.android.providers.media/databases/internal.db "SELECT title FROM files WHERE _id=%rturi(<)" Timeout (Seconds):0 Use Root:On Store Output In:%rtname Store Errors In:%rtqerror Store Result In: ]
A5: Flash [ Text:%rtname
%rtqerror Long:Off ]



Here is the log:
14.26.20/E Run Shell: %rturi -> %rturi
14.26.20/E Run Shell: %rtqerror -> %rtqerror
14.26.20/E Run Shell:  ->
14.26.20/Shell runBackground sqlite3 /data/data/com.android.providers.settings/databases/settings.db "SELECT value FROM system WHERE name='ringtone'" root: true timeout: -1
14.26.20/Shell start process-thread ID 104
14.26.20/E add wait type Shell7 time 2147483647
14.26.20/E add wait type Shell7 done
...

nanobrain

unread,
Aug 11, 2015, 3:13:25 PM8/11/15
to Tasker
What if you replace sqlite3 in your run shell commands with /data/data/com.keramidas.TitaniumBackup/files/sqlite3

Nicholas Johnson

unread,
Aug 11, 2015, 3:29:11 PM8/11/15
to Tasker
OK.  So after correcting some typos, i got the Java to work.  Thanks all!
Reply all
Reply to author
Forward
0 new messages