riul88 / call-recorder-for-android

call-recorder-for-android fork
159 stars 98 forks source link

Notification shows and fails to disappear on USSD request. #35

Open vi opened 8 years ago

vi commented 8 years ago

I do something like *100# and the recorder reacts with a notification.

p5n commented 7 years ago

I guess you need to check if phoneNumber member starts with * in src/com/callrecorder/android/RecordService.java private void startRecording(Intent intent) and just return from the beginning of this function.

p5n commented 7 years ago

Here is working patch:

diff --git a/src/com/callrecorder/android/MyPhoneReceiver.java b/src/com/callrecorder/android/MyPhoneReceiver.java
index 0c0fd99..97d8322 100644
--- a/src/com/callrecorder/android/MyPhoneReceiver.java
+++ b/src/com/callrecorder/android/MyPhoneReceiver.java
@@ -34,6 +34,11 @@ public class MyPhoneReceiver extends BroadcastReceiver {
        phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
        String extraState = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
        Log.d(Constants.TAG, "MyPhoneReciever phoneNumber "+phoneNumber);
+       if(phoneNumber != null &&
+          phoneNumber.startsWith("*")) {
+           Log.d(Constants.TAG, "MyPhoneReciever ignore phoneNumber "+phoneNumber);
+           return;
+       }

        if (MainActivity.updateExternalStorageState() == Constants.MEDIA_MOUNTED) {
            try {
p5n commented 7 years ago

Could you please merge https://github.com/riul88/call-recorder-for-android/pull/46 ? USSD recording attempts are quite annoying.