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 phonebook entry corresponding to this number. In particular, whether the contact has been assigned its own ringtone and receive its parameters. Ringtone has an isPlaying () method. But in all cases I get false for any ringtone. Question: how to correctly determine what ringtone actually 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()); 

    0