R
R
ragman2016-10-05 09:33:20
Android
ragman, 2016-10-05 09:33:20

How to programmatically find out what ringtone sounds during an incoming call?

Hello everyone.
There is an application that intercepts the moment of an incoming call and writes its parameters to the log file.
I managed to find out the number of the incoming call and the entry in the phone book corresponding to this number. In particular, whether the contact is assigned its own ringtone and get its parameters. The ringtone has an isPlaying() method . But in all cases I get false for any ringtone.
Question: how to correctly determine which ringtone really sounds during an incoming call?

String customRingtone = cursor.getString(c2.getColumnIndex(ContactsContract.Contacts.CUSTOM_RINGTONE));
Uri customRingtoneUri = Uri.parse(customRingtone);
Ringtone r = rm.getRingtone(context, customRingtoneUri);
String ringtoneIsPlayng = String.valueOf(r.isPlaying());

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question