diff --git a/app/assets/locales/android_translatable_strings.txt b/app/assets/locales/android_translatable_strings.txt
index ea216362d4..4d7f2a1637 100644
--- a/app/assets/locales/android_translatable_strings.txt
+++ b/app/assets/locales/android_translatable_strings.txt
@@ -459,6 +459,8 @@ recording.clear=Clear
recording.prompt.with.file.chooser=Record or choose sound below
recording.prompt.without.file.chooser=Record sound below
recording.custom=Recorded Sound
+recording.paused.due.another.app.recording.title=CommCare Audio Recording
+recording.paused.due.another.app.recording.message=Recording paused as another app with higher privileges started recording. Click here to resume the recording!
callout.failure.dialer=Device is not currently configured to make telephone calls
callout.failure.sms=SMS app not found
diff --git a/app/res/values/strings.xml b/app/res/values/strings.xml
index 58722a00b6..841a2ce818 100644
--- a/app/res/values/strings.xml
+++ b/app/res/values/strings.xml
@@ -455,4 +455,5 @@
FCM Notification
notification-channel-push-notifications
Required CommCare App is not installed on device
+ Audio Recording Notification
diff --git a/app/src/org/commcare/views/widgets/RecordingFragment.java b/app/src/org/commcare/views/widgets/RecordingFragment.java
index c10dd7651e..78d2a76d00 100644
--- a/app/src/org/commcare/views/widgets/RecordingFragment.java
+++ b/app/src/org/commcare/views/widgets/RecordingFragment.java
@@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Rect;
@@ -33,8 +34,11 @@
import androidx.fragment.app.DialogFragment;
import org.commcare.CommCareApplication;
+import org.commcare.CommCareNoficationManager;
+import org.commcare.activities.DispatchActivity;
import org.commcare.dalvik.R;
import org.commcare.utils.MediaUtil;
+import org.commcare.utils.NotificationUtil;
import org.javarosa.core.services.locale.Localization;
import java.io.File;
@@ -62,6 +66,7 @@ public class RecordingFragment extends DialogFragment {
private static final int HEAAC_SAMPLE_RATE = 44100;
private static final int AMRNB_SAMPLE_RATE = 8000;
+ private final int RECORDING_NOTIFICATION_ID = R.string.audio_recording_notification;
private String fileName;
private static final String FILE_EXT = ".mp3";
@@ -433,10 +438,20 @@ public void onRecordingConfigChanged(List configs)
if (hasRecordingGoneSilent(configs)) {
if (!inPausedState) {
pauseRecording();
+ NotificationUtil.showNotification(
+ getContext(),
+ CommCareNoficationManager.NOTIFICATION_CHANNEL_USER_SESSION_ID,
+ RECORDING_NOTIFICATION_ID,
+ Localization.get("recording.paused.due.another.app.recording.title"),
+ Localization.get("recording.paused.due.another.app.recording.message"),
+ new Intent(getContext(), DispatchActivity.class)
+ .setAction(Intent.ACTION_MAIN)
+ .addCategory(Intent.CATEGORY_LAUNCHER));
}
} else {
if (inPausedState) {
resumeRecording();
+ NotificationUtil.cancelNotification(getContext(), RECORDING_NOTIFICATION_ID);
}
}
}