But they are device-specific and you cannot use them on all phones.So, the short answer is no, you cannot turn on/off charging current using a standard Android app without rooting the device.
  • #1
Wrichik Basu
Science Advisor
Insights Author
Gold Member
2,138
2,713
In this article, I will show you how to create a ringtone picker using the RingtoneManager class in Android. You will be able to get the list of tones, display them as RadioButton , and let the user pick one tone from the list.
I expect you to have a basic knowledge of programming in Android. You should already have set up Android Studio and all the essential components required to build an Android app.
All code in this article will be in Java and not Kotlin.

Table of Contents
ToggleAn introduction to the RingtoneManager class:Launching the default ringtone picker using an implicit...


[url="https://www.physicsforums.com/insights/create-an-android-ringtone-picker-using-the-ringtonemanager-class/"]Continue reading...
 
Last edited by a moderator:
  • Like
Likes Greg Bernhardt
Computer science news on Phys.org
  • #2
May I suggest an Insights tutorial aimed at people who would like to get started with Android programming (assuming they have some prior programming on other platforms). What are the dev toolkits available, and which ones are the easiest to get started with?

Just as an example, MIT App Inventor is easy to learn and is surprisingly versatile for a "toy" system -- but where should I go next if I want to use Android features that aren't exposed in its environment?

I think many people would have toyed with the idea of making a small utility for their own use. E.g. -- what would be required if I want to make a mini-app that would add the battery charge percentage to the screen-saver?
 
  • Like
Likes Wrichik Basu and Greg Bernhardt
  • #3
Swamp Thing said:
May I suggest an Insights tutorial aimed at people who would like to get started with Android programming (assuming they have some prior programming on other platforms).
Good idea, but it cannot be one tutorial; if I write all the basics of Android in one article, it would become as long as LHC's technical design report.

One thing that kills the enthusiasm to some extent is that there is already a huge number of tutorials available on the net that will help you to get started with Android.

The biggest problem when one starts programming in Android is to set up Android Studio. If you have previously worked with Intellij IDEA and Gradle, then you will face lesser problems, but for someone going from NetBeans environment, it would be a big jump.

Anyways, thanks for the suggestion; I will surely look into it.
 
  • Like
Likes Greg Bernhardt
  • #4
I added some code to the article. A ringtone picker is incomplete if it does not play the tone you choose. Therefore, I added a media player to the activity.
 
  • #5
Is it possible for a standard Android app (one built on the regular dev tools) to turn on and turn off the charging current? And if so, would it work without rooting the device?
 
  • #6
Swamp Thing said:
Is it possible for a standard Android app (one built on the regular dev tools) to turn on and turn off the charging current? And if so, would it work without rooting the device?
Unfortunately Android does not provide any standard way of controlling charge current. All you can do is read the battery status (charging/discharging), battery health, and charge percentage, and for these Android provides the BatteryManager class, and three broadcasts: ACTION_BATTERY_CHANGED, ACTION_BATTERY_LOW and ACTION_BATTERY_OKAY.

Even if your phone is rooted, there is no standard way of doing this, because rooting itself is considered non-standard by the Android devs. There are Magisk modules that can control charge by modifying the firmware.
 
  • Like
Likes Swamp Thing

FAQ: Create an Android Ringtone Picker with Ringtonemanager Class

What is the Ringtonemanager Class?

The Ringtonemanager Class is a built-in Android class that manages all the ringtones and notification sounds on an Android device. It allows developers to access and modify the device's sound settings programmatically.

How do I use the Ringtonemanager Class to create a ringtone picker?

To create an Android ringtone picker using the Ringtonemanager Class, you will first need to get an instance of the Ringtonemanager by calling the getSystemService() method. Then, you can use the getCursor() method to retrieve a cursor containing all the available ringtones on the device. Finally, you can use this cursor to populate your ringtone picker with the available options.

Can I customize the ringtone picker using the Ringtonemanager Class?

Yes, the Ringtonemanager Class allows you to customize the ringtone picker by providing options to filter the available ringtones based on their type (i.e. ringtones, notification sounds, alarm tones), set a default ringtone, and specify the title and text for the ringtone picker dialog.

Are there any limitations when using the Ringtonemanager Class to create a ringtone picker?

One limitation of using the Ringtonemanager Class to create a ringtone picker is that it can only access and modify the ringtones and notification sounds that are available on the device. It cannot add new ringtones or notification sounds to the device.

Is the Ringtonemanager Class available on all Android devices?

The Ringtonemanager Class is available on all Android devices running on API level 1 or higher. However, the functionality and features may vary depending on the device's manufacturer and Android version. It is recommended to test the app on different devices to ensure compatibility.

Similar threads

Replies
13
Views
5K
Replies
0
Views
3K
Replies
6
Views
6K
Replies
1
Views
3K
Replies
1
Views
2K
Back
Top