简体   繁体   中英

Android Pie: Enable “Record all calls automatically” programmatically

Call recording APIs doesn't work on Android 9 anymore

Inbound & Outbound call recording on Android 9 doesn't work anymore using MediaPlayer. Only one sided voice is recorded (ignoring incoming voice).

With new Android 9 OS, it comes with in-built feature of turning on automatic call recordings. A solution to this could be to use the default phone system app, by enabling record all calls automatically.

So far only manual steps have been documented as mentioned below:

Vivo Go to Settings > System app settings > Phone > Call recording to enable Record all calls automatically

Xiaomi Steps may differ

Samsung Steps may differ

Need to achieve this programmatically

  1. I am looking for a solution to do this step programmatically keeping all mobile proprieties under consideration.

  2. Also need to fetch the default recording path programmatically (from settings on android phone) where the recording is auto-saved after call ending. For Vivo phones, this recording path is Internal_Memory/Recorder/Call/. It varies depending on mobile manufacturer.

Any help on this would be highly appreciated.

In order to solve your problem of finding the default path of the recorder. I got all the media files from storage with extension.mp3,.aac etc., and sorted it based on last modified name. The last file name and path gives the path of the default recorder.

TreeMap<Date, String> sortedMap = new TreeMap<Date, String>(all.mp3,.aac etc., files);

` File[] listRecFiles = song.listFiles();

            for (File filesName : listRecFiles) {

                if (filesName.getName().endsWith(extension)) {

                    modifdate = modifiedDate(filesName.getPath().toString());
                    songMap.put(modifdate, filesName.getPath());
                }
            }`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM