📱 How to Add an Android Ringtone Picker Using Intents + ActivityStarter (MIT App Inventor)

This tutorial shows how to open the system ringtone picker and retrieve the selected ringtone URI using ActivityStarter.


:white_check_mark: What This Does

  • Opens the native Android ringtone picker
  • Lets the user choose a ringtone
  • Returns the selected ringtone URI (e.g. content://media/internal/audio/media/27)
  • Displays or stores the URI for later use

:warning: This does not automatically set the ringtone. Android does not allow that via intent.
(You’ll need an extension like Taifun Settings for that.)


:jigsaw: Components Needed

From Connectivity:

  • ActivityStarter

From User Interface:

  • Button
  • Notifier (or Label)

:small_blue_diamond: Step 1: Configure the Ringtone Picker Intent

In Button.Click, configure ActivityStarter like this:

Action

android.intent.action.RINGTONE_PICKER

Extras (dictionary)

Key Value
android.intent.extra.ringtone.TYPE 1
android.intent.extra.ringtone.TITLE "Select ringtone"

Ringtone type values:

  • 1 = Ringtone
  • 2 = Notification
  • 4 = Alarm

Then call:

ActivityStarter.StartActivity

:small_blue_diamond: Step 2: Handle the Result

Android returns the selected ringtone in:

android.intent.extra.ringtone.PICKED_URI

This comes back in ActivityStarter.AfterActivity as a text string.

Example returned text

android.intent.extra.ringtone.PICKED_URI=content://media/internal/audio/media/27

:small_blue_diamond: Step 3: Extract the Picked URI

In:

when ActivityStarter.AfterActivity (result)

Use text processing to remove the key name and keep the URI.

Logic

  • Replace:

    android.intent.extra.ringtone.PICKED_URI=
    

    with:

    (empty string)
    

Store the result in a global variable, for example:

global ringtone

:small_blue_diamond: Step 4: Display or Save the URI

You can now:

  • Show it using Notifier.ShowAlert
  • Display it in a Label
  • Save it to TinyDB
  • Pass it to a settings extension later

Example output

content://media/internal/audio/media/27

:heavy_check_mark: This confirms the picker worked correctly.


:warning: Important Notes

:x: No “Set Ringtone” Intent

Android does not provide an intent like:

android.intent.action.SET_RINGTONE

You must either:

  • Let the user pick only

  • Or apply the ringtone using:

    • WRITE_SETTINGS permission
    • A Java-based extension (e.g. Taifun Settings)

:white_check_mark: Summary

:heavy_check_mark: Uses official Android intent
:heavy_check_mark: Works on modern Android versions
:heavy_check_mark: No special permissions needed
:heavy_check_mark: Fully compatible with App Inventor

Intent Action

android.intent.action.RINGTONE_PICKER

Returned Extra

android.intent.extra.ringtone.PICKED_URI

Next time, please submit your tutorial/guide to the correct category.

Also, if a user cannot actually set a different ringtone, what is the point of this ?

I would have loved to see some App Inventor blocks. Please change that. Now it looks AI generated.

1 Like