Set ringtone via script

R
Rafael Gold Contributor
Dänisches Bettenlager GmbH & Co. KG

Is there a possibility to set a file as a ringtone via script correctly?

I used following (just as an example test):

writesecuresetting -sys ringtone content://sdcard/dingdong.mp3

But for example following does:

writesecuresetting -sys notification_sound content://media/internal/audio/media/42

Do i have to change something before i can use this file or should it be in a different format/ folder etc.?

4 years ago
MobiControl - Android Script Engine
ANSWERS
RC
Raymond Chan Diamond Contributor
4 years ago (edited 4 years ago)

You haven't provided sufficient details for your implementation.  Whether or not any script  can be used to successfully change the ringtone depends very much on 

1. Device platform (OEM specific Android+ or generic Android-Enterprise)

2. Device brand

3. Android firmware and device agent version

 etc.

R
Rafael Gold Contributor
4 years ago

The thing is, i see that it's changed (in the settings) but it seem not working as if the path isn't correct.

I'm testing on Nokia 5.3 Android 10 with Android Enterprise Fully managed and Agent Version 14.5.0.1011.

A
ANKMOD@SOTI Silver Contributor
4 years ago

Hello Rafael

Greetings

Thanks for your Post on Soti central!!

Kindly let us test on our end for our specific use case and will give you an update shortly.  

Regards

R
Rafael Gold Contributor
4 years ago (edited 4 years ago)

That would be great.

I checked myself on a second device (Nokia 5.4) and have the same problem there.

Even i noticed that the path to the file is different when i look it up in the file browser (/storage/emulated/0/dingdong.mp3) but it didn't worked with this path too. 

I tried with /// at the start and without ".mp3" at the end, both with the same result.

RC
Raymond Chan Diamond Contributor
4 years ago

As you are using Android Enterprise device agent in managed-device mode, I don't think you currently can use writesecuresetting script command to set the device ringtone for AE device of any brand.  It is just not supported according to all related Google AE documents I can find.

You should be able to do that on Samsung devices running OEM-specific Samsung ELM Android+ device agent,, but not on Nokia or on any AE device.  I hope Google can include such API's as standard for AE devices in the near future.

 
R
Rafael Gold Contributor
4 years ago

But a change is visible in the settings and if i choose //media/internal/audio/media/42 instead of a normal path it's working well.

So, it seem the only problem is the access or link to the local file.

ÖC
Ömercan C.
2 years ago

Hello,

I also had the problem with Samsung devices and was able to solve it.


Here's an example of how I built the script:

writesecuresetting -sys ringtone /sdcard/Download/example.mp3

for dual Sim devices -> writesecuresetting -sys ringtone_2 /sdcard/Download/example.mp3

You must first save the ringtone file (e.g. example.mp3) under Downloads and then run the script.

RS
Rafael Schäfer Diamond Contributor
2 years ago

So my issue seem to be ti use "content:/" in the script.

But as we changed a lot and this thread is quite old, we don't need it anymore but still thanks for posting a solution so others can use it ;)